A March 2005 SitePoint Forums discussion described two ways to let a reader click one of five stars and submit that rating without separately choosing a radio button and pressing a submit button: link each star to its rating, or use JavaScript to put the selected value in a hidden form field and submit the form.
What the forum question asked
The original poster had a form with five radio buttons. They wanted each star image to send its value—one through five—when clicked, combining selection and submission into one action. The exchange is a historical record, not a current PHP implementation guide. Read the March 2005 discussion.
As an Amazon Associate I earn from qualifying purchases.
Two approaches in the replies
Make each star a link
One reply suggested giving each star its own link carrying the corresponding rating. The selected value is transmitted as part of the link request, rather than through a separate radio-button choice followed by a submit action.
Recommended Free Tools
Submit a form from a click handler
Another reply described attaching a JavaScript click handler to each star. The handler puts that star’s rating into a hidden form field and submits the form. The server-side handler then needs to read the submitted value; the hidden field is the bridge between the click and the form data.
#1 Best Overall
The thread does not establish a modern recommendation between these patterns, nor does it verify their current accessibility, security, or browser behavior. Its PHP examples use older conventions and should not be copied into a present-day application without review.
Why the submitted rating appeared to stay at zero
The poster initially reported that the received rating was still zero. In the exchange, the issue was traced to using the previously stored rating in the calculation of the new average instead of using the newly submitted rating. Those are separate values: the stored aggregate describes votes already counted, while the submitted value is the new vote to incorporate.
Rank #2
The discussion also covered retrieving an existing rating and vote count, calculating an updated average, and saving the new average and count. It is useful as an account of the specific bug discussed, not as validation of a production-ready formula or database update strategy. The thread does not address matters such as concurrent submissions.
Where the rating data was stored
The original poster said their article records had rating and times_rated columns for the aggregate rating and the number of votes. They also noted that a separate ratings table could be used instead, depending on how an application organizes its data. The discussion does not compare the designs or establish which is preferable for a current application.
Quick Recap
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




