Can't keep checkbox value using array
Posted: Wed Mar 02, 2005 10:13 pm
Someone please help. I am trying to keep the value of checkboxes(keep them checked if they are checked) if the user makes a mistake and has to re-do the form. I need to use an array to store my checkbox values. Here is a code example. Please help or modify. I've been at this for 2 days!!!
Thanks,
A person in need
feyd | please use
Code: Select all
<?php
print ("<BR>");
print ("<BR>");
foreach ($move as $value1) {
echo "Value: $value1<br />\n";
}
$arr = array('car', 'bike');
print("<form name=input action=?php_self method=get>");
reset($arr);
while (list(, $value) = each($arr)) {
print("I have a $value:");
print ("<input type=checkbox name="moveї]" value="$value"");
if($moveїvalue] == $arrїvalue]){
print ("CHECKED");
}
print (">");
print ("<BR>");
print ("$value1--$value");
print ("<BR>");
print ("<BR>");
}
print("<input type=submit value=Submit>");
print("</form>");
?>A person in need
feyd | please use
Code: Select all
whileCode: Select all
tags are offline[/color]