!想用像这样的复选框打印当前月份日期是 3 月,我从 1-03-2013 现在开始复选框 [],2-03-2013 现在 [] 到月底,31 个日期和 31 个复选框,现在我有数组 $isActive = $attendancelis['EmployeeAttendance']['is_active']; 中复选框的值。我想要复选框中的 $isActive 值,这就是全部。以下是输出print_r($attendancelis);
:
Array ( [EmployeeAttendance] => Array ( [id] => 5 [employee_id] => 8 [is_active] => 1 [date] => 2013-03-21 11:15:17 [day_month_year] => 2323123 ) ) Array ( [EmployeeAttendance] => Array ( [id] => 3 [employee_id] => 8 [is_active] => 1 [date] => 2013-03-12 17:47:03 [day_month_year] => 23213213 ) )
Array ( [EmployeeAttendance] => Array ( [id] => 0 [employee_id] => 8 [is_active] => 1 [date] => 2013-03-16 13:11:58 [day_month_year] => 324234324 ) ) -->
这是我的代码:
<?php
$nrDaysCurrentMonth = date("t");
for($dayNr = 1; $dayNr <= $nrDaysCurrentMonth; $dayNr++)
{
echo'<div style="width:300px;float:left;">';
echo date(''.$dayNr.'-m-Y');
echo '<input name="frmEmployeeAttendance[]" type="checkbox" value="0" />';
foreach($attendanceList as $attendanceLis)
{
$isActivee = $attendanceLis['EmployeeAttendance']['date'];
$isActiveYM = strtotime(date('d-m-Y', strtotime($isActivee)));
$isActiveYMD = date('j', strtotime($isActivee));
if($dayNr==$isActiveYMD) {
$isActive = $attendanceLis['EmployeeAttendance']['is_active'];
if ($isActive){
echo '<input name="frmEmployeeAttendance[]" type="checkbox" checked=="checked" value="' . $isActive . '" />';
}
else {
echo '<input name="frmEmployeeAttendance[]" type="checkbox" value="' . $isActive . '" />';
}
}
}
echo '<br/>';
echo'</div>';
}
?>