...

View Full Version : Child Menu Name Changes when parent Menu Changes



hurstVanrooj
08-31-2007, 02:57 PM
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

Fumigator
09-01-2007, 05:42 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum