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-31-2007, 02:57 PM   PM User | #1
hurstVanrooj
New to the CF scene

 
Join Date: Aug 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
hurstVanrooj is an unknown quantity at this point
Child Menu Name Changes when parent Menu Changes

Hi everybody - I hope this is easy to do! • PHP • MYSQL •

THIS IS FOR A SEARCH RECORDS IN A DATABASE TO MATCH SELECTED CRITERIA OF A DYNAMIC OPTIONS LIST
I have a set-up whereby the <select name=" "> of the List determines which field of the datbase is searched. I've create a dynamic drop down menu whereby the Parent menu changes the values of the child menu - that works fine.

Problem is, I want the <select name=" "> of the child menu to change accordingly so that it searches the field determined by the parent selection.

PARENT_______________ CHILD______________________________
HOURLY RATE -----------> £5.00 (searches the JOBS.hourly field)
___________________________________________________________

ANNUAL SALARY --------> £10,000 (searches the JOBS.annually field)
___________________________________________________________


The parent menu options are determined by a recordset from a SALARY table where salary.type is either "Hourly Rate" or "Annual Salary" and the same List menus are used to insert the hourly rate into the "JOBS.hourly field and the annually salary into the JOBS.annually" field of a new job availability.

So how do I get the child menu change it's name value when the parent menu is changed by the visitor? At the moment is is like this

<select name="hourly">

And that searches the hourly field - but I need it to change when the parent menu is changed to Annual Salary to

<select name="annually">

Many thanks
Hurst Vanrooj
hurstVanrooj is offline   Reply With Quote
Old 09-01-2007, 05:42 AM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,687
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
If the amount of data in each child group is not tremendous, I would build Javascript arrays from PHP and then use Javascript to reload the child Select element whenever the Parent select element changes.

If that doesn't appeal to you, then you'll want to set up an onchange event on the Parent Select element that submits the form so you can reload the page using the Parent value in the Child query.
__________________
Fumigator 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 11:32 PM.


Advertisement
Log in to turn off these ads.