html表单代码
/**
* PHP中获取表单单选框radiobutton数据的方法
*
* @param
* @arrange 512-笔记网: www.512Pic.com
**/
<html>
<body>
<form action=mychoice.PHP method=post>
<b>Enter Name:</b>
<input type=text size=45 name=username> <br>
<b>Please select your favorite animal:</b> <br>
<input type=radio name=animal value=dog>Dog
<input type=radio name=animal value=cat>Cat
<input type=radio name=animal value=fish>Fish <br>
<input type=submit value=Submit>
</form>
</body>
</html>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
后台PHP文件:mychoice.PHP
/**
* PHP中获取表单单选框radiobutton数据的方法
*
* @param
* @arrange 512-笔记网: www.512Pic.com
**/
<html>
<head>
<title>Form submission</title>
</head>
<body>
<br>
<?PHP
$username = $_POST['username'];
$animal = $_POST['animal'];
if(($animal != null))
{
$msg = The animal you chose is $animal <br>;
echo($msg);
}
?>
</body>
</html>
/*** 来自编程之家 jb51.cc(jb51.cc) ***/