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

// get-radio-data
<title>PHP Get Data from Radio Buttons</title>
<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
<input type="submit">

Filename: php / data.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 ?