Results 1 to 2 of 2

Thread: Retrieve values from radio buttons

  1. #1
    Join Date
    Jun 2011
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Retrieve values from radio buttons

    This is probably a very basic question, but I have trouble finding the solution and maybe someone can help me or direct me to some other sites.

    I have a page here: http://ppbm5.com/DB-PPBM5-3.php

    There are 9 tabbed panels with a number of radio buttons,



    and below that is a list of records from a MySQL database.

    I want the following to happen:

    1. When a radio button is clicked, I want to retrieve the value associated with the button.
    Should I use a hidden button with the 'On-click' property? How do I retrieve the value?

    2. I want to add that value to a variable used in a WHERE statement and update the mysql_query ("whatever").

    Example: When someone clicks on 'Asus' and the database is queried with the corresponding WHERE xxx ='Asus' , the number of records found goes down from 328 to say 91.

    3. After moving to another tab and clicking on another radio button, I want to retrieve the value associated with that button.

    4. I want to add that value to the previous variable and used in the WHERE statement and again update the mysql_query("whatever", "next choice").

    This also implies that the query itself must be embedded in a function to update the list of records from whatever tab one clicks.

    I hope you get my drift and can offer some suggestions.

  2. #2
    Join Date
    May 2011
    Posts
    16
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default

    Just use the onClick function against the radio buttons.

    To refresh the query you can use ajax.
    Nice ajax examples here.

    So essentially you have something like this.
    1. radio button clicked
    2. javascript function to call php page (ajax)
    3. php page query table based on new information
    4. javascript function retrieves the output from php page
    5. javascript function displays the output

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
  •