2013-09-16 40 views
3

我想創建一個考勤系統,使用PHP MySQL甚至是一個小jQuery。我想到的規範是讓所有成員在一個表格行中回顯,其餘的我希望有一個無限的日期數組,但逐月顯示。按天註冊出勤

我只是想知道我該如何將這個月的日子動態地加入到這張表中? 有沒有人有任何工作示例或指向正確的方向?

我有一個小型的佈局,去像這樣或查看我的jsFiddle

<form action='this_page.php' method='post'> 
<table> 
<th>Member</th> 
<th>Day One</th> 
<th>Day Two</th> 
<tr> 
    <td>Memeber One</td> 
    <td><input type='checkbox' name='student[davidsmith]' value='1' /></td> 
      <td><input type='checkbox' name='student[davidsmith]' value='1' /></td> 
</tr> 
<tr> 
    <td>Member Two</td> 
    <td><input type='checkbox' name='student[davidsmith]' value='1' /></td> 
      <td><input type='checkbox' name='student[davidsmith]' value='1' /></td> 
</tr> 
</table> 
</form> 

回答

2

不是100%確定你想要什麼,但要獲得一個月的日子裏,你可以使用PHP的DateTime

例如

$startDate = new DateTime(); //today 
$endDate = new DateTime('2013-12-31'); 

for ($c = $startDate; $c <= $endDate; $c->modify('+1 day')) { 
     echo $c->format('d'); 
} 

將打印天從今天到了今年餘下時間,使用->format('N')獲取月份名稱。 check hereformat()

+0

感謝那幫助我開始使用PHP DateTime參考! – 001221

1

接受而不是做這個手工作業的其他PARAMS並且也會讓你迷惑,而不是你可以在你下面的應用程序,它是開源和免費,以及:

Please try this application