Sorry, Me again (PHP)

Soldato
Joined
28 Sep 2008
Posts
14,207
Location
Britain
Ok, apart from my other issues, here's another one which I seem incapable of solving.

My form has a checkbox (now, nicely formatted thanks to Skyfall, etc).

When the form is submitted and the data passed to the DB, I want the DB to show a zero if its left unchecked, or a 1 if its checked.

This easy enough to do? Or is there a better method?

Thanks
 
Hmm, ok, how does that fit in with this which is the rest of my form?

PHP:
<?php
} else {
$field1 = stripslashes(mysql_real_escape_string($_POST['field1']));
$field2 = stripslashes(mysql_real_escape_string($_POST['field2']));
$field3 = stripslashes(mysql_real_escape_string($_POST['field3']));

mysql_query("INSERT INTO table (field1, field2, field3) VALUES 

('$field1','$field2','$field3')");
echo "Thank you. You have successfully added <font color=#FF0000>$field1</font> to the database";
}
mysql_close();
?>

Thanks for the phpfreaks link too
 
Back
Top Bottom