appointment time in dropdown with 15 min slot in php

<?php 
$a=explode(',','10:00-11:45,17:00-19:00');
$count_arr=count($a);
$s=array();
for($i=0;$i<$count_arr;$i++) {
    $stime=explode('-',$a[$i]);
    $s=array_merge($s,$stime);
}
?>
<?php 
$scount=count($s);
?>
<select style="width:85px;" name="select1" id="select1">
    <?php
for($t=0;$t<$scount;$t++){
    $start = strtotime($s[$t]);
    $t++;
    $end   = strtotime($s[$t]);
    for($i = $start;$i<$end;$i+=900){
        ?>
    <option value='<?php echo date('G:i', $i); ?>'><?php echo date('G:i', $i); ?></option>;
        <?php
    }
}
        ?>
</select>

Comments

Popular posts from this blog

dynamic create multiple ckeditor onclick event using jquery

get lat and long from city name using jquery

membership registration and login system in php