Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    1

    Unanswered: Interactive Dropdown Populate

    Hi all,

    I am a newbie to php & mysql. Can someone help me with the code to perform this task...

    I have a table with few fields... Lets say A, B, C, D & E...

    Now I want to display all these fields as a radio buttons. When someone selects "C" in radio button, the dropdown next to it must populate with all records of field "C" sorting alphabetically.

    I don't know how to populate dropdown dynamically as per the choice user makes in radio button...

    After that, user selects a particular item on dropdown menu. On clicking submit button the result.php must be generated by filter as shown...

    Select * From <tablename> Where "C"="selection from dropdown"

    I hope my query is well described. Step-by-step guide would be appreciated.

    Thanks in advance.

  2. #2
    Join Date
    Sep 2009
    Location
    San Sebastian, Spain
    Posts
    880
    I think you will need to have a look at Ajax in javascript. These allow you to get information remotely but you will need to use more javascript to empty and then populate the dropbox. The Ajax call will interact with the PHP code which then talks with the database. I suggest you raise this in the PHP or javascript forum.

    Here is an example of Ajax in action: errno

    You add in the errno value and it will search in the database for the corresponding text without ever moving from the web page. The javascript takes the returning text, empties the results area and then applies the returned text string in the results area.
    Ronan Cashell
    Certified Oracle DBA/Certified MySQL Expert (DBA & Cluster DBA)
    http://www.it-iss.com
    Follow me on Twitter

Posting Permissions

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