Jump to content

checkboxes


gevo12321

Recommended Posts

store the value in the database as something like, 0 = not checked and 1 = checked or something. then when you access page get the data from the table and run the checking.

 

eg:

$checkbox_5 = mysql_result(mysql_query("SELECT `checkbox_5` FROM `table`"), 0);

if($checkbox_5 == 0){
$checked_5 = "";
}else{
$checked_5 = "checked='checked'";
}

echo <<<html
<input type="checkbox" name="box5" value="cat" {$checked_5}>
html;

 

there is one way of doing it, but if you have lots of checkboxes it may get annoying adding them all in.

Link to comment
https://forums.phpfreaks.com/topic/57478-checkboxes/#findComment-284550
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.