Jump to content

<select> won't populate


vegemite

Recommended Posts

Hi All,

 

I'm a PHP newbie and I'm a bit stumped.  :-[

 

For some reason my "month" drop-down won't populate with an array's values.

 

Can someone please help me?

 

I'm running PHP v5.2 on Ubuntu Server.

 

Here is the code, minus the unimportant bits:

 

<form action="calendar.php" method="post>
<?php

$months = array (1 => 'January',
'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September',
'October', 'November', 'December');

echo '<select name="month">';
foreach ($months as $key => $value) {
echo "<option value=\"$key\">$value</option>\n";
}
echo '</select>';

?>
</form>

 

 

In Firefox it simply shows text:

 

January February March April May June July August September October November December

 

Thanks for any help!

 

Ash

Link to comment
https://forums.phpfreaks.com/topic/160092-wont-populate/
Share on other sites

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.