|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
hi,
With the help of, some of the threads posted here, i tried to populate a dropdown list, but no data is being populated from database, my dropdown is always empty. I dont know what to do, i spent a whole day in this, but it didnt work. Pls somebody help me. This is my code, <html> <body> <select name = thing> <?php include ("third.php")?> <? $sql="SELECT id, thing FROM guest"; $result=mysql_query($sql); $options=""; while ($row=mysql_fetch_array($result)) { $id=$row["id"]; $thing=$row["thing"]; $options.="<OPTION VALUE=\"$id\">".$thing.'</option>'; } mysql_query($result); ?> </select> <input name="step" type="hidden" value="1" /> <input name="submit" type="submit" value="add" /> </body> </html> I dont know whats the problem here, but no data is being populated and the dropdown is empty. In my database, under table guest, i have two fields named 1. id 2. thing. Pls somebody help me thanking you ramya |
|
#2
|
||||
|
||||
|
You forgot to output the options
replace the line PHP Code:
with the line PHP Code:
And it should work PS: <select name = thing> should be <select name="thing">, you forgot the quotes |
|
#3
|
|||
|
|||
|
Great,
It worked. Thank you so muchhhhhhhhhhhhhh ri |
|
#4
|
||||
|
||||
|
You're welcome.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Problem with populating dropdown |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|