/ Published in: PHP

These arrays are good for filling out a drop down menu for time that increments by 30 minutes. The forms can submit the data and be useful for inserting it into a database for time of day information.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php $hour_slot = 0; $min_slot = 0; for( $i = 0; $i<47; $i++) { if( $i == 0) { $arr_time[$str_time] = $str_time; } if( $i%2 == 0 ) { $min_slot=30; } else { $min_slot=0; } $arr_time[$str_time] = $str_time; if( $i%2 == 0 ) { $hour_slot++; } } ?>
Comments
