Please delete me
Please delete me

Reputation:

drop down box php

I have stored 6 records in mysql db,when i use this code each of the 6 records getting displayed in seprate drop down box,i want them to be displayed in a single drop down box.Where am i going wrong? Any help ii be appreciated. Thnx in advance.

http://dpaste.com/hold/180077/

Upvotes: 0

Views: 221

Answers (3)

unholysampler
unholysampler

Reputation: 17341

You need to put the select outside of the for loop. Just the option tag and it's contents should be written in the loop.

Upvotes: 0

webbiedave
webbiedave

Reputation: 48887

You want to do something like this:

<select>
while ($row = mysql_fetch_array($result)) {
    echo "<option><!-- put option text here --></option>\n";       
}
</select>

Upvotes: 1

MJB
MJB

Reputation: 7686

On line 17, you should have multiple options printed, with one select and one end-select.

Upvotes: 0

Related Questions