<?php

function AddPlayTime ($oldPlayTime, $PlayTimeToAdd) {
$old=explode(":",$oldPlayTime);
$play=explode(":",$PlayTimeToAdd);

$hours=$old[0]+$play[0];
$minutes=$old[1]+$play[1];
if($minutes > 59){
$minutes=$minutes-60;
$hours++;
}
if($minutes < 10){
$minutes = "0".$minutes;
}
if($minutes == 0){
$minutes = "00";
}
$sum=$hours.":".$minutes;
return $sum;
}

navDbQuery("golf.config", "", "configrecid");


if(navHaveRows())
{
$startTime = $_SESSION['row']['starttime'];
//echo "starttime from database is $startTime";
$durationTime = $_SESSION['row']['duration'];
$sum = $startTime;

// Don't add this here ... you want the start time to appear first.
// $sum = AddPlayTime($startTime,$durationTime);
}
if ($sum!=false)
{
//echo $startTime." + ".$durationTime." === ".$sum;
?>

<td align="right"> Reservation Time :&nbsp;</td>
<td align="left"><select name="reservtime" type="text" class="textbox" id="reservtime" value="" size="1">

<?
for($i = 1; $i < 12; $i++)
{?>
<option value="<?echo $sum?> "><?echo $sum?> </option>
<?
$sum = AddPlayTime($sum,$durationTime);//$sum. " + ".$durationTime;
}?>
</select></td>
</tr>