Current location: Hot Scripts Forums » Programming Languages » PHP » load data in combo box


load data in combo box

Reply
  #1 (permalink)  
Old 12-29-03, 06:09 PM
AlexGM14 AlexGM14 is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
load data in combo box

hi im building a gaming website and i have this link thats titled: "PS2" and when you click on it i want all the game titles i have in my database to appear in the combo box. then when i they hilite the game they r looking for, i want a submit button for them to click on that takes them to the info part of the game.

so in my database would i need 3 columns..id, title, and info?

and once i make the database how do i set the combo box code up, plz point me in the right direction.
Reply With Quote
  #2 (permalink)  
Old 12-29-03, 08:15 PM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

1) Pass a parameter like 'ps2' via URL when "PS2" is clicked. By parameter, I mean something like this:

Code:
<a href="foo.php?c=ps2">PS2</a>
2) Based on what parameter you have passed, query the database (i.e. get all the titles for 'ps2').

3) Create a form and <select> tags, as well as a submit button that will pass another parameter. For instance, if a user has chosen "Final Fantasy 9", then 'ff9', along with the 'ps2', etc. Then get a detail page based on these parameters.

4) As for the database, it depends on what you want to show, but using 'ff9' as an ID (PK), "Final Fantasy 9" as Title, and whatever the contents you want to show as Info seems okay, if all you want to show can/should be stored in one field Info.

5) As for creating the <option> tags within the <select> tags, you can loop the query result.

Sorry I'm not too detailed, but this is the approach I would take, more or less. Hope this gives you some idea.
__________________
Blavv =|
Reply With Quote
Reply

Bookmarks


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
Problem getting data from DataGrid on update petersza ASP.NET 5 10-19-04 11:37 PM
How to Extract Intra Day Stock Price Data from Java Chart??? (only source of data!!) omkarsnisal Everything Java 0 10-29-03 02:25 AM
retrieve data from combo box sasi ASP 1 09-03-03 06:16 PM
Print data by date perleo PHP 2 08-09-03 09:35 AM


All times are GMT -5. The time now is 07:48 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.