SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2006
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing PHP between forms on same page

    Many thanks in advance to all who offer help.

    Yep, yet another newbie question. So new to php it is causing a real headache

    On my webpage i currently have two drop down boxes for user selected options where the selection comes from different MySql tables. The first box display ok, without any issue, but the second will not as when the page is first loaded, the variable being used to define the selection is blank as the first box has not been chosen.

    How to refresh the page or do whatever is necessary, so that when the user choses their selection form the first drop down, then that choice can be used to define the WHERE element of the mysql query.

  2. #2
    SitePoint Zealot mwasif's Avatar
    Join Date
    Apr 2007
    Location
    Pakistan
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use javascript event onchange on the first dropdown to submit the values on the same page. And you should query for the 2nd dropdown only when the value is provided.

  3. #3
    SitePoint Wizard bronze trophy devbanana's Avatar
    Join Date
    Apr 2006
    Location
    Pennsylvania
    Posts
    1,736
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or you can use AJAX. When the first dropdown is changed, retrieve the values for the second dropdown through AJAX. You'll need to do a lot of reading and studying for that one though if you've not studied it yet.
    Laudetur Iesus Christus!
    Christ's Little Flock
    Jesus is the Good Shepherd

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does this code help:Plus2net:
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.


Bookmarks

Posting Permissions

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