/ Published in: PHP
A simple function that generates a select drop down. It takes 3 values. The select name ,the mode (true for hours / false for minutes) and the selected option.
Expand |
Embed | Plain Text
function timeSelect($name,$mode,$selected) { if($mode) { $mode = 24; } else { $mode = 60; } echo '<option value="-1">--</option>'; for ($i=0;$i<$mode;$i++) { if($i <=9) { $i = "0".$i; } if($i == $selected) { } else { } } echo '</select>'; } // use like timeSelect("event_start_hour",true,$_POST['event_start_hour']); timeSelect("event_start_minute",false,$_POST['event_start_hour']);
You need to login to post a comment.
