Jump to content

Dropdown box with values from database


Recommended Posts

Hello, im trying to create a script that would make a form, with a dropdown box and the option values would come from my database.

 

Can you give me some advice how to do this?

 

SELECT name FROM foodmenu WHERE creator="$username" ORDER BY name ASC;

 

My first time asking, so if i miss some necessary info, please ask

  • 2 weeks later...

Start by creating the initial part of the <select> tag.

 

Then execute your query and loop through the result set,  creating a <option></option> for each row returned.

 

Finish it off by closing the <select> tag.

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.