Hi Friends.....
I have two radio button in web page i.e. one is male and other is female. I want to know how to save value of radio button in MySql database ? Please tell me anyone ?
Thanks...........
Radio Buttonin PHP
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 18, 2012, 10:21 AM EDT
Try this...
config.php
/* Database Connection */
$sDbHost = 'localhost';
$sDbName = 'test';
$sDbUser = 'root';
$sDbPwd = '';
$dbConn = mysql_connect ($sDbHost, $sDbUser, $sDbPwd) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($sDbName,$dbConn) or die('Cannot select database. ' . mysql_error());
?>
form.php
update.php
session_start();
include("config.php");
$gender = $_POST['Gender'];
$query="INSERT INTO data (gender) VALUES ('".$gender."')";
mysql_query($query) or die ('Error updating database');
echo "Record is inserted.";
?>
Thanks
If this post helps you mark it as answer
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Mar 20, 2012, 12:01 PM EDT