|
Posted by ulyx on 12/06/06 17:59
I hope i have write this correct. I get no error, but i can see any new
updated data in db. There is no updating ?
I have created tested table and field.
?>
<form action="testCheckBox.php" name="test" method="post">
<?
$weekdays = array( "mon" => "Monday",
"tue" => "Tuesday",
"wed" => "Wednesday",
"thr" => "Thursday",
"fri" => "Friday",
"sat" => "Saturday",
"sun" => "Sunday" );
// initialize $days as being empty:
$days = array();
echo "<b>Days of Service:</b><br />";
foreach( $weekdays as $value => $desc ) { //walk through possible values
echo ' <INPUT type="checkbox" name=days[]" value="'.$value.'"';
echo ( in_array( $value,$days ) ) ? " CHECKED" : ""; //if days are
already selected, check the box
echo '>'.$desc.'<br />'; //echo the descriptive name of the item
}
$daylist = implode(",",$days);
//$result = mysql_query("UPDATE dbTest SET db_days = '$daylist' WHILE
record_id = $record_id");
$days = explode(",", $dbTest ['db_days']);
?>
<input type="submit" name="Submit" value="Submit">
</form>
[Back to original message]
|