Current location: Hot Scripts Forums » Other Discussions » Database » Populate a drop down box in HTML file using a PHP script file


Populate a drop down box in HTML file using a PHP script file

Reply
  #1 (permalink)  
Old 12-30-09, 12:53 PM
timbaker1991's Avatar
timbaker1991 timbaker1991 is offline
Newbie Coder
 
Join Date: Dec 2009
Location: London, UK
Posts: 38
Thanks: 2
Thanked 3 Times in 3 Posts
Populate a drop down box in HTML file using a PHP script file

I want populate a drop down list from a colum in a MySQL database, the drop down box is in an HTML file and i want to put the processing code in a php file, whats more on click of submit i want it to the return the whole of the row from which the drop down box selected, again in a HTML page.
Is this possible?
I think im being stupid but cant get to figure it out

Thank you tim
Reply With Quote
  #2 (permalink)  
Old 12-30-09, 02:28 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Yes, it's possible.

You'll need to fetch all of the rows that you want as <option> elements, then loop through them and build the select list, adding a unique number or ID key to each one. When the user clicks the submit button, get the number or ID key from the selected option, run another query using the number or ID key to grab that row from the database and display it in the resulting page.

Quote:
Originally Posted by timbaker1991 View Post
I want populate a drop down list from a colum in a MySQL database, the drop down box is in an HTML file and i want to put the processing code in a php file, whats more on click of submit i want it to the return the whole of the row from which the drop down box selected, again in a HTML page.
Is this possible?
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 12-30-09, 04:05 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,515
Thanks: 20
Thanked 109 Times in 106 Posts
Reply With Quote
Reply

Bookmarks

Tags
drop down menu, mysql, php, populate


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML code file update on the webserver using CGI script sujata_ghosh Perl 31 07-06-06 03:06 AM
Video PHP Script - New Videos Daily yelbom General Advertisements 0 03-03-06 01:04 AM
PHP File Upload/User Manager Script Needed Computra Script Requests 2 11-09-05 02:39 PM
populate a drop down box minority ASP 3 06-28-05 10:12 AM
Script for picking the first HTML file out of a directory (with sorted HTML files) jelteveld Script Requests 0 08-16-03 01:30 PM


All times are GMT -5. The time now is 05:14 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.