I created a table having a column to store data of type time (00:00:00) eg attendance record. that involve storing date_in and time_in.
I am able to get the user to select the time using the following script:
$hours = '<select name="hour" class="tiny">'."\n";
$minutes = '<select name="min" class="tiny">'."\n";
function check($num)
{
if($num<10 && strlen($num)<2)
{
$num = '0'.$num;
}
return $num;
}
for($i=0; $i<13; $i++)
{
$hours .= '<option value="'.check($i).'">'.check($i).'</option>'."\n";
}
$hours .= '</select>';
for($i=0; $i<60; $i++)
{
$minutes .= '<option value="'.check($i).'">'.check($i).'</option>'."\n";
}
$minutes .= '</select>';
and in the form:
<td>Time: </td>
<td valign="top" class="style1"><?php echo $hours; ?> : <?php echo $minutes; ?> </td>
I use the following to store the time:
$time_in=date('h:i:s',strtotime($hours.':'.$minutes));
The problem is how do I retrieve the time from the table so that I can change and update the time if possible using the same form format.