PHP支持多維請求參數。但是你需要改變表單結構。我給你一個簡單的例子:
<?php
if(isset($_POST) && isset($_POST['example_checkbox'])) {
foreach($_POST['example_checkbox'] as $key => $value) {
echo "The balue of $key is $value<br />";
}
exit;
}
?>
<html>
<head>
<title>Example</title>
</head>
<body>
<form method="post">
<input type="checkbox" name="example_checkbox[checkbox_1]" value="1" />1<br />
<input type="checkbox" name="example_checkbox[checkbox_2]" value="2" />2<br />
<input type="checkbox" name="example_checkbox[checkbox_3]" value="3" />3<br />
<input type="checkbox" name="example_checkbox[checkbox_4]" value="4" />4<br />
<input type="checkbox" name="example_checkbox[checkbox_5]" value="5" />5<br />
<input type="checkbox" name="example_checkbox[checkbox_6]" value="6" />6<br />
<input type="submit" />
</form>
</body>
</html>
化妝複選框作爲陣列 2014-12-13 08:28:03
,讓我錯誤..無效的論據等等等等等等 – 2014-12-13 08:29:04
檢查它我現在提交 – 2014-12-13 08:39:40