私は次のHTMLを持っています:
<input type="checkbox" name="plusfri[]" value="Fri"> Friday
<input type="checkbox" name="plussat[]" value="Sat"> Saturday
<input type="checkbox" name="plussun[]" value="Sun"> Sunday
<input type="checkbox" name="plusmon[]" value="Mon"> Monday
これは、次の PHP に投稿します。
$plus = array(array("Name" => "", "Days" => "", "Age" => "","Conc" => ""));
foreach($_POST['plusname'] as $k => $p)
{
$plus[$k]['Name'] = $p;
$plus[$k]['Age'] = $_POST['plusage'][$k];
$plus[$k]['Conc'] = $_POST['plusconc'][$k];
$plus[$k]['Days'] = "X";
if($_POST['plusfri'][$k]=="Fri") $plus[$k]['Days'] .= "1";
if($_POST['plussat'][$k]=="Sat") $plus[$k]['Days'] .= "2";
if($_POST['plussun'][$k]=="Sun") $plus[$k]['Days'] .= "3";
if($_POST['plusmon'][$k]=="Mon") $plus[$k]['Days'] .= "4";
}
そして、私は次のようになります:
array(3) {
[0]=>
array(4) {
["Name"]=>
string(6) "FRISAT"
["Days"]=>
string(3) "X12"
["Age"]=>
string(1) "1"
["Conc"]=>
string(0) ""
}
[1]=>
array(4) {
["Name"]=>
string(6) "SATSUn"
["Age"]=>
string(1) "1"
["Conc"]=>
string(0) ""
["Days"]=>
string(3) "X23"
}
[2]=>
array(4) {
["Name"]=>
string(6) "SUNMON"
["Age"]=>
string(1) "1"
["Conc"]=>
string(0) ""
["Days"]=>
string(3) "X34"
}
}
要素 [1] と [2] だけで「Days」が最後までジャンプした理由を誰か教えてもらえますか??>