Jump to content

[SOLVED] populate short month to long month name


busnut

Recommended Posts

G'day

 

I've got this bit below where users can select the month & year of their choice, but I can't seem to work out how to get it to display the full month name.

the value of the search needs to be in the 3 letter format (ie, Jan, Feb, Mar etc etc), but what the users see in the dropdown box needs to be 'January', 'February', 'March' etc etc.

 

<Select NAME="month">
<?php
echo "<option value=".date(M).">".date(F)."</option>";
echo "<option>-----</option>";
$arr = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
foreach ($arr as $value) {
echo "<Option VALUE=$value>$value</option>";
}
?>
  <Option VALUE="">All Year</option>
</Select>

 

It works for the first month that is displayed (which is the current month), but i've tried with failing getting it to display in the same format for the 12 months listed.

 

Any help appreciated!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.