Important alert: (current site time 7/15/2013 10:14:50 AM EDT)
 

winzip icon

^Fill a select Box From database (mysql database)

Email
Submitted on: 11/13/2001 10:17:09 PM
By: Tolinio Christodoulou  
Level: Beginner
User Rating: By 9 Users
Compatibility: PHP 3.0, PHP 4.0
Views: 49693
(About the author)
 
     This is an example of how you can fill a select box with values and text from a mysql database. It shows how to connect to the database and loop through the fields and add the data in a select box
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 3 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/28/2003 1:48:16 PM

Very useful, i'm used to vb and asp but decided to learn PHP so all the snippets are very helpful. Just one thing on this bit of code, the section that is as follows:

$results= mysql_query("SELECT ID, NAME from TestTable Order by Cat asc",$connection);

You need to change "Order by Cat" to "Order by Name" because the CreateTheTables.txt does not contain any Cat field otherwise no data displays. (Hope this helps).. Regards.. Joe.
(If this comment was disrespectful, please report it.)

 
12/10/2003 1:13:32 AMCoding MasterMind

Thanks a lot Chris, this is the most efficient and suitable way to perform what I needed. I have shuffled the code a little to suit the requirements of my project, it works perfectly. I am extremely grateful, if there is anything you need help with, just email me and I will try to help you in return.
(If this comment was disrespectful, please report it.)

 
10/15/2004 8:22:38 PMAdam Szabo

Thank you very much! Using your example I was able to modify my own code to do something I have been trying to do for 2 days now! 5 globes!
(If this comment was disrespectful, please report it.)

 
8/30/2005 2:48:58 AMsuziana

dont know where can get reservation code
(If this comment was disrespectful, please report it.)

 
8/30/2005 2:54:49 AMsuziana

put button search in website to give easy get information
(If this comment was disrespectful, please report it.)

 
10/13/2006 2:56:55 AMJulius

good Work Man!
(If this comment was disrespectful, please report it.)

 
4/11/2007 11:53:46 AMshan

how to create an air ticket online booking system in .php
(If this comment was disrespectful, please report it.)

 
8/7/2007 8:21:54 PMdarq

nice
(If this comment was disrespectful, please report it.)

 
7/22/2009 9:42:19 AMmakanga

nice work.Thank you for I have learned From you.
(If this comment was disrespectful, please report it.)

 
11/7/2009 3:10:15 AMrogo

thans for sharing
(If this comment was disrespectful, please report it.)

 
6/28/2011 10:40:37 AMTaufiq

Great !
Thank you, for i have learned from you
(If this comment was disrespectful, please report it.)

 
12/8/2011 8:53:27 AMDanny

very useful thax dude!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.