先看HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>按钮数据发送</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="get.php">
选项:
<label>
<input name="mid" type="checkbox" id="mid" value="0" />
</label>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="1" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="2" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="3" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="4" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="5" />
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form></body>
</html>get.php获取到所有name为mid的值,并且输出为 0,1,2,3,4,5很简单吧。可我就是不会,哪位大哥帮帮忙。谢谢了.之前我用echo $_POST["mid"];老是只获取到最后那个..郁闷啊
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>按钮数据发送</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="get.php">
选项:
<label>
<input name="mid" type="checkbox" id="mid" value="0" />
</label>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="1" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="2" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="3" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="4" />
</p>
<p>选项:
<label></label>
<input name="mid" type="checkbox" id="mid" value="5" />
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form></body>
</html>get.php获取到所有name为mid的值,并且输出为 0,1,2,3,4,5很简单吧。可我就是不会,哪位大哥帮帮忙。谢谢了.之前我用echo $_POST["mid"];老是只获取到最后那个..郁闷啊
<input type='checkbox' name='mid[]' value="0" />$cb = $_POST["mid"];
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>按钮数据发送</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="get.php">
选项:
<label>
<input name="mid[]" type="checkbox" id="mid" value="0" />
</label>
<p>选项:
<label></label>
<input name="mid[]" type="checkbox" id="mid" value="1" />
</p>
<p>选项:
<label></label>
<input name="mid[]" type="checkbox" id="mid" value="2" />
</p>
<p>选项:
<label></label>
<input name="mid[]" type="checkbox" id="mid" value="3" />
</p>
<p>选项:
<label></label>
<input name="mid[]" type="checkbox" id="mid" value="4" />
</p>
<p>选项:
<label></label>
<input name="mid[]" type="checkbox" id="mid" value="5" />
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</p>
</form></body>
</html>$mids =$_POST['mid'];
for($i=0;$i<count($mids);$i++)
echo $mids['mid'][$i]