Jump to content

Filling a listbox

- - - - -

  • Please log in to reply
1 reply to this topic

#1
brad35309

brad35309

    Newbie

  • Members
  • Pip
  • 2 posts
Im creating an inventory database that records a purchase date as a field. ive created three list boxes and want to automatically populate the day box depending on what month is selected. also, when the page is generated id like it to populate the year box with the years 1980-2030. i know there has to be a way to populate it besides doing

    <option>1980</option>

    <option>1981</option>

    
so on and so fourth
i was thinking of mabye putting it in a loop when the page is loaded that fills the list options. Any suggestions ideas?

#2
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
  • Location:New York, NY
for($i = 1980; $i < 2030; $i++) {

echo "<option>$i</option>";

}





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users