March 7th, 2013, 08:59 PM
How to retrieve the database values to drop down list
Hi friends i need your help in php programming please tell me how to retrieve the values from database to drop down list and the drop down list consists of multiple selections plzzz reply me soon
March 7th, 2013, 09:13 PM
If I undertand you correctly... You wish to create a drop-down menu from the selection of items from a table in a database?
If so, research "how-to php mysql select" to retrieve the items you want. Then, within a while() loop, just echo out the <option ...> for the current row as it goes thru the selected items from the database.
March 7th, 2013, 09:28 PM
Originally Posted by Triple_Nothing
Yes i have done the same thing what u have said to me but the drop down list is not at all apearing its just displaying as a bar but not the drop down list
can u send me sample code
The following was the code which i have return:-
<?php echo $row['value']; ?> </option>
plzz send me an example code so that i can understand easily because i have already done all the things which you have sent to me
March 7th, 2013, 09:33 PM
March 8th, 2013, 12:22 AM
I don't know what you mean by displaying as a bar, but if you want it to be a dropdown then don't include the "multiple" attribute in your select tag.
March 8th, 2013, 01:18 AM
Originally Posted by E-Oreo
I mean to say that its not displaying in a proper way i have used multiple in select because there should be multiple selections under a single ddl i.e it is a multiple selection ddl
March 8th, 2013, 02:52 AM
So in your browser, now view the source. This will show you what HTML you have created with your PHP. What does that look like? Does it look like HTML dropdown examples you have found?
Originally Posted by Tejasree
(in firefox it's <ctrl>-u )
March 8th, 2013, 03:47 AM
<?php foreach($values as $value) : ?>
<option><?= $value['name'] ?></option>
<?php endforeach ?>
March 8th, 2013, 09:33 AM
Is ur line missing the $?
March 8th, 2013, 09:42 PM
Originally Posted by notflip
thanq i got it