Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •