Passing Array values to a validation script a
Posted: Wed Oct 01, 2008 2:50 pm
~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:
Posting Code in the Forums to learn how to do it too.
I need to create a dynamic table and do so w/the following code
This works great to create the checkboxes. From here I need to pass the array to a validation page where I use the code
This also works
If the validation script returns true I enter the values from the Facility array with
this code works
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:
Posting Code in the Forums to learn how to do it too.
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: