I need to create a dynamic table and do so w/the following code
Code: Select all
$facility_sql=mysql_query("SELECT * from facility");
while($myrow=mysql_fetch_array($facility_sql))
{
$myrow[Fac_Name]<br><input type=checkbox name=Facility[] value=$myrow[Fac_ID]<br>";
}
Code: Select all
$Facility=$_POST['Facility'];
if(!isset($Facility) or count($Facility)==0){
$status_form="NOTOK";
$msg .="At least one facility needs to be checked<br>";
}If the validation script returns true I enter the values from the Facility array with
Code: Select all
foreach(_POST['Facility'] as $value){
$sql="INSERT into where_used_facility(Fac_ID,Prod_ID)VALUSE($value,$Last_Prod_ID)";
$result=mysql_query($sql)
}My problem is how do I set the checkbox to checked when the validation scripr returns an error on another field. I do not want to have the user reenter values for previously checked checkboxes.I have tried Implode/Explode and serialize/unserialize alune with urlencode all with no luck
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: