Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-08-2002, 06:52 PM   PM User | #1
HormonX
New Coder

 
Join Date: Aug 2002
Location: Toronto, Canada
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
HormonX is an unknown quantity at this point
passing variables

well .. here i go again ...

is there a way to pass 2 variables from one form element. What am trying to do is this, in the pull down menu i have 2 distinct values i would like to pass. is there a way of passing the second variable some how ?

in the pull-down menu i have category and the subcategory

when you want to select something from the menu it looks somethig like this

category1 - subcategory1
category2 - subcategory2
category3 - subcategory3

is there any way so both of them are getting passed ?

please help

thanx HormonX
HormonX is offline   Reply With Quote
Old 08-08-2002, 07:34 PM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
It would be easier if you just used two select boxes with one being the categories and the second being the subcategories. Like this:

http://javascriptkit.com/script/cut183.shtml

Then when submitted both values would be available to your php script.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 08-08-2002, 07:47 PM   PM User | #3
HormonX
New Coder

 
Join Date: Aug 2002
Location: Toronto, Canada
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
HormonX is an unknown quantity at this point
you are right, it would be much easier ... i need the second menu (subcategory menu ) to be created dynamicaly. Am not that good with JavaScript that's why i haven't done that using JavaScript. It was much easier for me to pull 2 values from database and display them in one pull down menu.

The problem am having is that in not sure how to put PHP and Java Script together.

Do you know of a sample form just the one you showed me but done dynamicaly ?

thanx in advance

HormonX
HormonX is offline   Reply With Quote
Old 08-08-2002, 07:50 PM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
You can pull the data from a db with that same concept. Use the first combo to select a category. Use an onchange event to trigger a form submit and query the database based on the selection and then regenerate the second combo box with the values that were pulled.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 08-08-2002, 08:09 PM   PM User | #5
HormonX
New Coder

 
Join Date: Aug 2002
Location: Toronto, Canada
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
HormonX is an unknown quantity at this point
i got the concept on how to do it ... but being a novice .. am not sure where to begin and how to put things together, but thanx for the tip.

HormonX
HormonX is offline   Reply With Quote
Old 08-08-2002, 08:35 PM   PM User | #6
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
To populate the second combo box using a db:

http://www.faqts.com/knowledge_base/...id/6123/fid/51

Just use the value obtained from the first combo box to use as the search criteria for the query on the database.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:48 PM.


Advertisement
Log in to turn off these ads.