Return to Snippet

Revision: 8530
at September 26, 2008 15:59 by davidsword


Updated Code
//On form; checkbox option
echo "<input name='chbx' value='1' type='checkbox' CHECKED>";


//After form, find value of chbx for database
$showhide = (isset($_POST['chbx']) && $_POST['chbx'] == '1')? 1 : 0; 


//Retrieving from database, find if chbx is checked for redisplaying original sumbission
$ckd = (isset($row['chbx']) && $row['chbx'] == '1')? "CHECKED" : ""; 
$checkbox = "<input name='chbx' value='1' type='checkbox' $chk>";

Revision: 8529
at September 26, 2008 15:58 by davidsword


Initial Code
//On form; checkbox option
echo "<input name='chbx' value='1' type='checkbox' CHECKED>";


//After form, find value of chbx for database
$showhide = (isset($_POST['chbx']) && $_POST['chbx'] == '1')? 1 : 0; 


//Retrieving from database, find if chbx is checked for redisplaying original sumbission
$ckd = (isset($row['chbx']) && $row['chbx'] == '1')? "CHECKED" : ""; 
$checkbox "<input name='chbx' value='1' type='checkbox' $chk>";

Initial URL
http://davidsword.ca/

Initial Description
I always forget how to do this...

Initial Title
Inserting/Retrieving checkbox values from database

Initial Tags
form, database

Initial Language
PHP