ChatterBank0 min ago
I'd like to add a 5-star rating tool to my site...
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.
Answers
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.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
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
http://www.unblue.co.uk/rating.php?pagenumber=1&ra
ting=2
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.
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.
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.