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...........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Mar 18, 2012, 2:21 PM
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 SainiPosted Mar 20, 2012, 4:01 PM