Validate check box ?
Posted: Sun Jan 24, 2010 5:49 am
Hi all,
I have a simple form to insert users into a DB.
This works fine but I also have an unchecked checkbox which I require users to check
(or error message). What do I need to add to the code below to validate the checkbox ?
Checkbox is called "terms_box".
Thanks all.
Best wishes
Monty
I have a simple form to insert users into a DB.
This works fine but I also have an unchecked checkbox which I require users to check
(or error message). What do I need to add to the code below to validate the checkbox ?
Checkbox is called "terms_box".
Thanks all.
Best wishes
Monty
Code: Select all
if (isset ($_POST['SignUp'])){
$sql = mysql_query("INSERT INTO `students_to_courses` ( `id` , `student_fk` , `course_fk` , `course_completed` )
VALUES ('', '$id', '2', '0')")
or die (mysql_error());
$id = mysql_insert_id();