need to submit a value on radiobutton click (PHP picture rating system)

Discussion in 'Programming' started by PatMcCrackit, Mar 8, 2010.

  1. #1
    Just as the title says, I am creating an image rating system - somewhat like hotornot.com. I have 10 radiobuttons numbered 1-10 and i need them to submit their own value using $_POST when one of the radio buttons is clicked. I'm not sure how to go about this... I see a lot of sites like this using Javascript. Is there any way around using javascript? what can I do?

    Thanks a lot,
    Pat
     
    PatMcCrackit, Mar 8, 2010 IP
  2. Nyu

    Nyu Peon

    Messages:
    79
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You will need to use Javascript if you want to submit your form if someone clicks the radio button. It's only one simple line of code that you have to add within the onclick attribute to all your radio buttons.

    <input type="radio" name="rating-2" onclick="document.myformname.submit()">
    Code (markup):
    Then you can work with the values of the radio buttons just the same way as you would do if the user had hit the submit button of the form
     
    Nyu, Mar 9, 2010 IP