How to use PHP & Radio Button This tutorial how to using PHP read a variable from Radio Button
ShotDev Focus:
- Using PHP & Radio Button
Example
php_radio1.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="php_radio2.php" method="post" name="form1"> Please select sex.<br> <input name="rdoSex" type="radio" value="Man">Man<br> <input name="rdoSex" type="radio" value="Woman">Woman<br> <input name="btnSubmit" type="submit" value="Submit"> </form> </body> </html>
php_radio2.php
<html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <? echo $_POST["rdoSex"]; ?> </body> </html>
Create a php file and save to path root-path/myphp/
Run
http://localhost/myphp/php_radio1.php
Screenshot