View Single Post
  #9 (permalink)  
Old 08-21-2008, 11:17 PM
Brett
 
Posts: n/a
Diggs:
Default Michael Fesser if you are there please help

Hi Micha,

Sorry for waking you. You helped me once before on this and I'm hoping
you can help me again.

I have decided to change all of the date fields on my update page to
drop down lists, and using your technique I have successfully done the
month and day fields. The problem I'm having is with the year field. I
have an array $years = range(2006, 2016) to populate the list, but what
is being saved on update is the key not the value. Here's the code:

> <label for="select">Year:</label>
> <?php print "<select name='year' id='year'>\n";
> for ($i = 1; $i <=9; $i++) {
> printf("<option value='%4u',%s>%s</option>\n",
> $i,
> $i == $mysqldate[0] ? " selected='selected' ": '',
> $years[$i-1]
> );
> }
> print "</select>\n"; ?>


After updating when I view the record list I see Aug. 21, 0003. I have
been scratching my head over this one trying to figure out how to get
the value not the key saved in the table. What am I doing wrong?

Thanks for your help, again.

Brett

Reply With Quote