<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>php如何读取单选按钮[radio]值</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="RadioGroup1" value="1" />
单选</label>
1<br />
<label>
<input type="radio" name="RadioGroup1" value="2" />
单选</label>
2</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<br />
</p>
</form>
</body>
</html>
<?
if( $_POST )
{
echo '你选择了单选择',$_POST['RadioGroup1'];
//由于单选按钮的属性同一时间只能被选中一个就所直接把他们名字相同就OK了。
}
时间: 2024-11-10 00:21:45