best way to populate 'select' box options on forms?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ant_sutton
Forum Commoner
Posts: 32
Joined: Thu May 05, 2005 5:27 am

best way to populate 'select' box options on forms?

Post by ant_sutton »

Hi guys.

I have a series of select boxes on a form. I am currently generating the values to be shown in the select box by assigning an array with the values to a variable in the php script and then using that variable for the 'options' of the select. Is this the best way to do this? I could also create a database table with the options in and query the database everytime the script is ran. I'm thinking this is less efficient though?

I also want users to be able to add new options to the select box too so I need to considetr which method makes this easier.

thanks for any help

Anthony
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

if your making a GUI where your client can modify the fields, then use a database. Editing the files directly will only lead to nightmares.
ant_sutton
Forum Commoner
Posts: 32
Joined: Thu May 05, 2005 5:27 am

re

Post by ant_sutton »

Hi. thanks for your reply jcart. I didnt think it through properly. It will be a GUI where the user can add new options so I think the only way would be to use a DB. thanks alot
Post Reply