Donate SIGN UP

I'd like to add a 5-star rating tool to my site...

Avatar Image
sno-man | 21:41 Mon 09th Jun 2003 | Technology
6 Answers
Hi, I'd like to add a thing to my site where visitors can choose a rating, out of 5. Then, when they submit it, the average rating is displayed in its place. Does anyone offer this? Thanks.
Gravatar

Answers

1 to 6 of 6rss feed

Best Answer

No best answer has yet been selected by sno-man. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.
Dunno, but the scripting to do this is trivial. If your webspace supports perl, (or preferably php), I'll help you write it.
Question Author
Yes please- that'd be good.
OK, I've assumed you've got PHP scripting capabilities. The script can handle ratings for multiple pages over an adjustable scale. It will handle errors in all variables supplied, plus filesystem errors. It's also documented to give you an idea of what's going on. You might look at it and go "eh?", but it'll all make sense to someone who takes the time to look through what I've done. The output is also just a number, but you could probably patch it into some graphical representation quite easily. I ask that anyone who cuts and uses the script acknowledges where they got it from (ie. www.unblue.co.uk), and other than that... enjoy:

http://www.unblue.co.uk/ratingcode.txt
Oh and you pass it variable in the URL, ie.

http://www.unblue.co.uk/rating.php?pagenumber=1&ra
ting=2
Question Author
Thanks very much. I've never really done PHP before..., but I'm familiar with HTML. How would I add this code to my site? Thanks again.
It really depends on how your ISP allows you to run PHP code. Mine for example has a separate server for security reasons, and it makes PHP a major headache.
What I've given you is basically the code to manage a flatfile database. You're going to need to give me more details (like the HTML you want it embedded into) if you need more help. In essence, you're going to need an HTML form for the submission bit, that can submit the variables to this script. The output from this script will then need to be adjusted to give whatever HTML you want in return. Don't forget to change HTTP_GET_VARS to HTTP_POST_VARS if this is how you're submitting your form details.

1 to 6 of 6rss feed

Do you know the answer?

I'd like to add a 5-star rating tool to my site...

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.