I.T. Discussion Community!
-Collapse +Expand
Search PHP Group:

-Collapse +Expand PHP Store

Prestwood eMagazine

August Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPHP & Delphi for PHP BoardPHP Topic   Print This     

dropdownbox that is populated from a mysql db?

dropdownbox that is populated from a mysql db? in PHP topic (part of our PHP & Delphi for PHP group).

Quick Search: dropdownbox   populated   dropdownbox that   dropdownbox that populated   mysql db  
Most Recent Post
Baton Rouge, LA USA

Hello everyone, I am wanting to create a dropdown list box that is populated from a mysql database, currently I have figured how to query out what information I need from my database but I do not know how to get it to display correctly in the drop down box. Can someone give me some pointers or help? Down below is a sample code I have created which queries my database and shows the information I queried on the screen, can anyone give me some pointers or lead me in the right direction on making the listbox have the values? After I get that far, I may have other questions, because once someone clicks on one of the values from the dropdown list, I would like to run a query on the value selected and show values on the screen based on what is clicked.. Thank you guys for your time.




$link = @mysql_connect ( "localhost", $user, $pass );

if ( ! $link ) {
 die ( "Couldn't Connect to Preferred Breeders Database. Try Again".mysql_error());

 or die ( "Couldn't open $db: ".mysql_error() );

$result=mysql_query("SELECT DISTINCT NAME FROM test.states WHERE (STATE = 'MS')");


 while ($a_row=mysql_fetch_row($result)){

 print "\n";
 foreach ($a_row as $field){
  print "$field
 print "\n";



 Posted 11 years ago (Thread Starter)
Comment Quote
About S0nY -Collapse +Expand
Visit Profile
Approved member.
Member does not subscribe to this thread.

Post ID #13578, No Replies Be the first!
Thread Started 7/1/2009 12:24:18 PM
View Counter=4129
Last Reply Posted 12/29/2015 12:54:47 AM)
Location=Baton Rouge, LA USA 
Joined=13 years ago   MB Posts=53  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1124A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #13578 Counter
Since 7/1/2009

Follow PrestwoodBoards on: 

©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech