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 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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

  • #5
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #6
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,273
    Thanks
    4
    Thanked 83 Times in 82 Posts
    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


  •  

    Posting Permissions

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