Hi..
Im new to php..Please help me
I created 2 tables and 2 forms
ringodetails-Table1
servicedetails-Table2
In service.php form i have to display the customer names in a drop down list from the ringodetails table
I got customer names in the ringodetails table
How to implement this....
Thx in advance
Display data in drop down list
Moderator: General Moderators
-
danielbala
- Forum Newbie
- Posts: 9
- Joined: Tue Jan 24, 2012 4:27 pm
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Display data in drop down list
You need to select all the customer names from the ringodetails table. Then place the results in an array from where you display them.
Code: Select all
<?php
$qry = "SELECT `customer_name` FROM `ringodetails`";
$sql = mysql_query($qry);
echo '<select name="aName">';
while ($ary = mysql_fetch_array($sql)) {
echo '<option>' . htmlentities($ary['customer_name'], ENT_QUOTES) . '</option>';
}
echo '</select>';
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering