Hi guys,
I have some confusion here - I am trying to create a check box where when you tick the box but forget to fill in some other fields - How can you make sure the box stays ticked when we are taken back to the application page?
Here is snippets of the code:
The Form
I tired used session e.g:
but it is still did not work - can anyone please assist me what I need to edit or did wrong.
Thanks.
I have some confusion here - I am trying to create a check box where when you tick the box but forget to fill in some other fields - How can you make sure the box stays ticked when we are taken back to the application page?
Here is snippets of the code:
PHP Code:
..
$error = 0;
$errormsg = "";
..
if( !isset($_POST['noemail']) && (empty($_POST['email1']) || !check_text($_POST['email1'])) ) {
$error = 1;
$errormsg .= "Please enter your requested email address 1<br>";
$errornum[3] = 1;
}
if( !isset($_POST['noemail']) && (empty($_POST['email2']) || !check_text($_POST['email2'])) ) {
$error = 1;
$errormsg .= "Please enter your requested email address 2<br>";
$errornum[3] = 1;
}..
Code:
.. .. <tr> <td><input name="noemail" type="checkbox" value="noemail"> Do not want to get the E-mail address </td> </tr> <tr> <td nowrap>First Choice <input name="email1" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email1'].'"'; } ?>> </td> </tr> <tr> <td nowrap>Second Choice <input name="email2" type="text" <?php if ($_POST['action'] == "register") { echo 'value="'.$_POST['email2'].'"'; } ?>> </td> </tr>
I tired used session e.g:
PHP Code:
<td><input name="noemail" type="checkbox" value="noemail"<?php echo ($_SESSION["noemail"]=='noemail' ? ' checked="checked"' : '');?>>
Thanks.
Comment