How to put If statement in printf ?
Posted: Thu Sep 26, 2013 8:37 am
I have a following problem -
I need to select current time from dropdown thats rounded off to 15 minutes.
The problem i need to select the time and i cant figure out how to select it using if statement.
THis is what i have
$rounded = "current time";
<select name="selTimeAt" class="select-combo" id="selTimeAt">
<?php
$start=strtotime('00:00');
$end=strtotime('23:45');
for ($halfhour=$start;$halfhour<=$end;$halfhour=$halfhour+15*60) {
printf('<option value="%s">%s</option>',date('H:i',$halfhour),date('g:i a',$halfhour));
}
?>
</select>
In printf i assumed i just add if tatement and done but i been tearing my hair out and got result of none.
If any one can help i would greatly appreciate it.
I need to select current time from dropdown thats rounded off to 15 minutes.
The problem i need to select the time and i cant figure out how to select it using if statement.
THis is what i have
$rounded = "current time";
<select name="selTimeAt" class="select-combo" id="selTimeAt">
<?php
$start=strtotime('00:00');
$end=strtotime('23:45');
for ($halfhour=$start;$halfhour<=$end;$halfhour=$halfhour+15*60) {
printf('<option value="%s">%s</option>',date('H:i',$halfhour),date('g:i a',$halfhour));
}
?>
</select>
In printf i assumed i just add if tatement and done but i been tearing my hair out and got result of none.
If any one can help i would greatly appreciate it.