Hello:
I'm trying to make a form field which is a checkbox be sticky.
For starters, did I correctly code the checkbox for it to be sticky?
When I run the script, I'm receiving this message:
Parse error: syntax error, unexpected ';'
and I can't seem to find the problem.
This is the line of code causing the problem:
<input type="checkbox" name="availability[]" id="availability" value="Weekday Mornings"<?php echo (isset ($_SESSION['availability']) && $_SESSION['availability'] == 'Weekday Mornings' ? ' checked="checked"' : ''; ?> />Weekday mornings<br>
I do have the variable validated in the beginning of the script. Everything works fine but when I started to make the fields sticky, the checkbox field doesn't want to remain checked.
This is my validation code:
if (isset($_POST['availability']) && (is_array($_POST['availability']))) {
$_SESSION['availability'] = TRUE;
} else {
$errors[] = 'Availability is a required field, Please select at least one.';
}
Thanks for all the help.