How can I put this array into a select menu, It is sort of a mini date picker
<?php
$start=‘2011-12-05’;
$end=‘2011-12-16’;
$totaldays=((date(strtotime($end))-date(strtotime($start)))/86400);
$d= substr($start,8,2); // last 2 digits = Day
$m= substr($start,5,2); // 2 middle digits = Month
$y= substr($start,0,4); // first 4 digits = Year
$test=array(); // Declare ARRAY
for($i=0; $i<=$totaldays; $i++){
$test[$i]=date(‘D, M-d’,mktime(0,0,0,$m,($d+$i),$y)); // Increases day until it gets to totaldays
// echo $test[$i].“<br/>”;
}
?>
<pre><?php print_r($test); ?></pre>
<form id=“form1” name=“form1” method=“post” action=“”>
Start Date: <input type = “date” name = “doj” /><br />
<input type = “submit” value = “Submit” />
</form>
Here’s another way, I imagined you’d really want a 2011-12-25 style date passed back to your form handler, if you did not then it can be one line less.
I’m making a time sheet for where I work.
I’m learning as I go along. The employees will log in and enter their daily hours.
Any help is appreciated, thanks
The start and end date will come from the database and limit them to enter only those dates of the pay period.
the start date and end will be a pull down menu
the start and end time, havn’t figured that out yet, there is too much to have a pull down in 15 min blocks
lunch and break times
Sorry i left for work.
Ya, they enter it the same day or next day. They put the time they started and the time they finished with the date started and an extended date if the shift carried over to the next day, like a night shift.