-2
我想獲取表單數組中的複選框數組。我試圖首先獲取數據作爲表單數組,然後獲取數組中的複選框數組。表單數組中的複選框數組
<form name="preview" id="post" action="" method="post">
<input type="hidden" name="category[$id]" />
<input type="checkbox" name="subcat[]" value="something" />
<input type="checkbox" name="subcat[]" value="somewhere" />
<input type="checkbox" name="subcat[]" value="something" />
<input type="checkbox" name="subcat[]" value="somewhere" />
<input type="hidden" name="category[$id]" />
<input type="checkbox" name="subcat[]" value="something" />
<input type="checkbox" name="subcat[]" value="somewhere" />
<input type="checkbox" name="subcat[]" value="something" />
<input type="checkbox" name="subcat[]" value="somewhere" />
<input class="button-primary" name="submit_preview" value="Submit Selected Tees" type="submit">
</form>
if (isset($_POST['submit_preview'])) {
foreach ($_POST[ 'category' ] as $id) {
foreach ($_POST[ 'subcat' ][$id] as $subcat) {
echo $subcat;
}
}
}
.....而問題是? – samayo 2013-03-03 00:37:46
問題是在問題 – jazzytomato 2013-03-03 00:38:54
Downvoted沒有問題沒有問號。 – Nathaniel 2013-03-03 00:40:59