Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Registering attendance by day [closed]

Tags:

jquery

php

mysql

I want to create an attendance system using PHP MySQL and even a little jQuery. The specification I have in mind is to have all my members echoed in one table row and in the rest I would like to have an infinite array of dates but showing month by month.

I just wanted to know how I could get the days of the month into this table dynamically? Does anyone have any working examples or point me into the right direction?

I have a mini layout which goes like so or view my 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>
like image 517
GSG Avatar asked Dec 03 '25 04:12

GSG


1 Answers

Not 100% sure what you want, but to get the days of a month, you can use PHP's DateTime

e.g.

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

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

will print the days from today to the rest of the year, use ->format('N') to get the month name. check here for other params accepted by format()

like image 197
E Ciotti Avatar answered Dec 04 '25 17:12

E Ciotti