Insert values in the database with a checkbox in HTML and PHP
In this tutorial, we will try to understand the program of inserting the values in the database with the checkbox in HTML and PHP.
<?php mysql_select_db('gender',mysql_connect('localhost','root','')); ?> <form method="post"> <input type="checkbox" name="zz" value="male"> male<br> <input type="submit" name="gender" value="submit" /> </form> <?php if(isset($_POST['gender'])) { $a=$_POST['zz']; mysql_query("insert into student(marks) VALUES('$a')"); header('location:gender.php'); } ?>