我遇到了一个问题,即我们无法将我们的复选框与其他字段联系起来。
如果我们只检查第二个复选框,它将取第一行选择框的值。
行按日期连接起来,例如2014-06-02,2014-06-03
HTML
<input type="checkbox" name="date_choice[]" value="2014-06-02">
<select id="event_start" name="event_start[2014-06-02][]" onchange="area_choice_click()">
<option value="">Start Time</option>
<option value="01:00">1.00AM</option>
<option value="02:00">2.00AM</option>
<option value="03:00">3.00AM</option>
</select>
<select id="event_end" name="event_end[2014-06-02][]" onchange="area_choice_click()">
<option value="">End Time</option>
<option value="01:00">1.00AM</option>
<option value="02:00">2.00AM</option>
<option value="03:00">3.00AM</option>
</select>
<input type="checkbox" name="date_choice[]" value="2014-06-03">
<select id="event_start" name="event_start[2014-06-03][]" onchange="area_choice_click()">
<option value="">Start Time</option>
<option value="01:00">1.00AM</option>
<option value="02:00">2.00AM</option>
<option value="03:00">3.00AM</option>
</select>
<select id="event_end" name="event_end[2014-06-03][]" onchange="area_choice_click()">
<option value="">End Time</option>
<option value="01:00">1.00AM</option>
<option value="02:00">2.00AM</option>
<option value="03:00">3.00AM</option>
</select>
PHP
foreach($_POST['date_choice'] as $key=>$team_id){
$event_date = $_POST['date_choice'][$key];
echo"$event_date";
$event_start=$_POST['event_start'][$event_date][$key];
}