I am using the following which basically prints a dropdown box showing all hours with 30 minute increments:
$start = '12:00AM';
$end = '11:59PM';
$interval = '+30 minutes';
$start_str = strtotime($start);
$end_str = strtotime($end);
$now_str = $start_str;
echo '<select name="doors_open">';
while($now_str <= $end_str){
echo '<option value="' . date('h:i A', $now_str) . '">' . date('h:i A', $now_str) . '</option>';
$now_str = strtotime($interval, $now_str);
}
echo '</select>';
BUT, i want to do it twice for another field further down the page... question is, how do I reset the loop?
Here's what I've tried but doesn't work:
echo '<select name="event_start">';
reset($now_str);
reset($end_str);
while($now_str <= $end_str){
echo '<option value="' . date('h:i A', $now_str) . '">' . date('h:i A', $now_str) . '</option>';
$now_str = strtotime($interval, $now_str);
}
echo '</select>';