Question:
Radio buttons on forms?
jeff lemon
2006-12-06 07:39:23 UTC
I want people to be able to rate things on my website, how do I implement radio buttons for a rating of 1 to 5?

I also need to submit what people choose to a sql database.

And then retrive it and show a certain image for each number 1 to 5, e.g. a five star image for a value of 5.

Thanks
Three answers:
Biff
2006-12-06 16:29:27 UTC
To create the radio buttons you need to use input tags inside your form like this:

1

2

3

4

5



Once the form is submitted you need a server-side script to handle the incoming data and a way to store it. PHP and MySQL are a common (and free) solution for this that your hosting company have probably given you. This combination of software can also be used to retrieve the stored ratings and create the code to show the ratings. You could probably find images of stars online that are available for free use, but if you want to create them yourself then check out the GIMP (it's free too).



Here are some useful links:



More details on input tags: http://www.w3schools.com/tags/tag_input.asp



Learn PHP: http://www.w3schools.com/php/default.asp



Learn how to use PHP to interface with MySQL: http://www.w3schools.com/php/php_mysql_intro.asp



Get the GIMP:

http://gimp-win.sourceforge.net/



There are also many free tutorials online that you could find using Google or Yahoo.
joannaserah
2006-12-06 15:49:21 UTC
There's some out there already. Just search for rating scripts, or other words like that. Probably PHP or JavaScript would have a lot.
Shahid Usmani
2006-12-06 16:10:18 UTC
assign each radio button a value using the attribute 'value' and submitted that value to the database dont forget to name the radio button.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...