Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Insert values in database with radio button in HTML and PHP

Table of Contents

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');
}
?>
Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.