Hi all,
I wonder if anyone could give me some idea: I have a form and one of the filed is an email (must field) if empty an error message will show up: - Now I want to add a CHECKBOX where when the CHECKBPX is clicked the "must field" email will become" not must field one" (Not required field).
I have this code as my snippets:
Can anyone assist me what shall I add so I can achieve this please?
Thanks in advance.
Siabanie
I wonder if anyone could give me some idea: I have a form and one of the filed is an email (must field) if empty an error message will show up: - Now I want to add a CHECKBOX where when the CHECKBPX is clicked the "must field" email will become" not must field one" (Not required field).
I have this code as my snippets:
Code:
<form action="<?php echo $PHP_SELF;?>" method="post" name="reg1"> .. <tr> <td><input name="noemail" type="checkbox" value="noemail"> Do not want to get the E-mail address</td> </tr> <tr> <td nowrap>Enter email <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> .. </form>
PHP Code:
..
..
$error = 0;
$errormsg = "";
..
..
if ($_POST['action'] == "register") {
if (($_POST['email1'] == "") OR (!check_text($_POST['email1']))) {
$error = 1;
$errormsg .= "Please enter your requested email address<br>";
$errornum[3] = 1;
}
}
..
Thanks in advance.
Siabanie
Comment