PHP Get Data from Radio Buttons - Code

PHP Get Data From Check Boxes Previous Next PHP Sent E-MAIL From PHP


Radio buttons let a user select ONLY ONE of a limited number of choices.

Filename: php / get-radio-data.html


Code
 
// get-radio-data
<html>
<head>
<title>PHP Get Data from Radio Buttons</title>
</head>
<body>
<form action="radio-data.php" method="post">
Name: <input type="text" name="name">
Age: <input type="number" name="age">
<input type="radio" name="gender" value="Male"> Male
<input type="radio" name="gender" value="Female"> Female
<br/>
<input type="submit">
</form>
</body>
</html>

Filename: php / data.php


Code
 
<?php;
$name = $_POST["name"];
$age = $_POST["age"];
$gender = $_POST["gender"];
echo "Welcome $name <br> You are $age years old.<br> And you are a $gender.";
?>

Running Step.


Type Url - https://localhost/php/get-radio-data.html


Tags: PHP Get Data from Radio Buttons PHP Code Programming Language


Was this helpful ?