Step
1:
Start the XAMPP server
Click on the "Start" button next to "Apache" to start your Apache Web server and also start "MySQL"
Click on the "Start" button next to "Apache" to start your Apache Web server and also start "MySQL"
Step 2:
Create Radio.html
<!doctype
html>
<html
lang="en:US">
<head>
<meta
charset="UTF-8">
<title>Get
RadioButton Value</title>
</head>
<body>
<form
method="post" action="rad.php">
Gender:</br>
<input
type ="radio" name="gender" value="Male"
checked>Male</br>
<input
type ="radio" name="gender"
value="Female">Female</br>
<input
type ="radio" name="gender"
value="Other">Other</br>
<input
type="submit" name="submitbtn" value="Click"/>
</form>
</body>
</html>
Step
3:
Create rad.php
<?php
if(isset($_POST['submitbtn']))
{
$Gender=$_POST['gender'];
if($Gender == "Male")
{
echo("Male");
}
else if($Gender == "Female")
{
echo("Female");
}
else
{
echo("Other");
}
}
?>
Step
4 :
Save both the file(Radio.html,rad.php) in htdocs under xampp server
in c:drive.
Step
5:
Open the browser (chrome)
and type it
localhost/ Radio.html
Gender:
Male
Female
Other
Male
Female
Other
After
clicking button you can get the following output
Male
No comments:
Post a Comment