Hello all...I have been struggling with this for hours now and I have read several posts and have gotten myself all turned around. Help would be appreciated. These are small snippets of the code. The problem is with avalable_days[] checkboxes:
//I initiate variables for the form (which is very large ...over 140 fields)
if (isset($hour_sal_amt)){
$hour_sal_amt=$hour_sal_amt;
} else $hour_sal_amt="";
if (isset['available_days']) {
$available_days=$available_days;
} else $available_days="";
if (isset($avail_startdate)) {
$avail_startdate=$avail_startdate;
} else $avail_startdate="";
if (isset($shifts)){
$shifts=$shifts;
//validation
if(!isset($_POST['available_days'])) $errors.="• What days of the week are you available to work?<br>";
if(strlen($errors)>0)
{
$pageno=2;
include("errorbox.inc");
}
//then I have the form fields
<input name="available_days[M]" type="checkbox" <? if (isset($_POST['available_days']['M'] )){echo "checked";}?>>
M
<input name="available_days[T]" type="checkbox" <? if (isset($_POST['available_days']['T'] )){echo "checked";}?>>
T
<input name="available_days[W]" type="checkbox" <? if (isset($_POST['available_days']['W'] )){echo "checked";}?>>
W
<input name="available_days[Th]" type="checkbox" <? if (isset($_POST['available_days']['Th'] )){echo "checked";}?>>
Th
<input name="available_days[F]" type="checkbox" <? if (isset($_POST['available_days']['F'] )){echo "checked";}?>>
F
<input name="available_days[Sat]" type="checkbox" <? if (isset($_POST['available_days']['Sat'] )){echo "checked";}?>>
Sat
<input name="available_days[Sun]" type="checkbox" <? if (isset($_POST['available_days']['Sun'] )){echo "checked";}?>>
Sun
The error message pops up even if something had been checked and the checked checkboxes do not remained checked. Do I need to loop? I am lost.
Thanks