Insert values in database with radio button in HTML and PHP

Insert values in the database with radio button in HTML and PHP

In this tutorial, we will try to understand the program of inserting the values in the database with radio button in HTML and PHP.

<?php
mysql_select_db('gender',mysql_connect('localhost','root',''));
?>
<form method="post">
Gender:
<input type="radio" name="zz" value="male"> Male<br>
<input type="radio" name="zz" value="female"> Female<br>
<input type="submit" name="gender" value="car"  />
</form>
<?php
if(isset($_POST['gender']))
{
$a=$_POST['zz'];
mysql_query("insert into student(gender) VALUES('$a')");

header('location:gender.php');
}
?>
Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.