Hi all,
I have created a html form which contains a checkbox.
When the user checks this box and hit submit a value of 'yes' should be stored in the database.
Here is my checkbox code...
<input name="paid" type="checkbox" id="paid" value="yes">
Here is insert code...
if ($paid && $enter) //$enter is submit button
{
@ $db = mysql_connect('localhost', 'user', 'passwd');
if (!$db)
{
echo ' Could not connect to db.';
exit;
}
// select which database to use
mysql_select_db('bookings');
$query = mysql_query("INSERT INTO customer (paid) VALUES ('".$paid."')");
$result = mysql_query($query);
echo mysql_affected_rows($result).' details inserted into database';
}
My field for paid in the db is...char(3), null, default(no)
I would be very grateful for your help. Thanks very much.
Kevin.