Hello,
Im trying to create a dynmic dropdown menu for use on a scheduling system and im wondering the best way to go about it.
Example:
<select name="select">
<option selected>- Select Day -</option>
<option>Sunday, 18th Sep</option>
<option>Monday, 19th Sep</option>
<option>Tuesday, 20th Sep</option>
<option>Wednesday, 21st Sep</option>
<option>Thursday, 22nd Sep - Today</option>
<option>Friday, 23rd Sep</option>
<option>Saturday, 24th Sep</option>
<option>- Next Week -</option>
<option>Sunday, 25th Sep</option>
<option>Monday, 26th Sep</option>
<option>Tuesday, 27th Sep</option>
<option>Wednesday, 28th Sep</option>
<option>Thursday, 29th Sep</option>
<option>Friday, 30th Sep</option>
<option>Saturday, 1st Oct</option>
</select>
Now, obviously the dates would need to be dynamic, and update themselves.
I have already got todays date, and set the timezone for GMT:
$date = date('Y-m-d H:i:s', time() + 28800);
But now im clueless as to how I would dynamically create the dropdown menu.
Im looking into using arrays, such as:
$month_names = array(
1 => _('January'),
_('February'),
_('March'),
_('April'),
_('May'),
_('June'),
_('July'),
_('August'),
_('September'),
_('October'),
_('November'),
_('December'),
);
$day_names = array(
_('Sunday'),
_('Monday'),
_('Tuesday'),
_('Wednesday'),
_('Thursday'),
_('Friday'),
_('Saturday'),
);
?>
But Im not sure what to do with the arrays or how to use them.
Any help is greatly welcome
Thanks