Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk2 min

How a Five-Star Rating Form Without Radio Buttons Worked in a 2005 PHP Forum Thread

A historical SitePoint discussion covers star links and JavaScript form submission, plus a bug caused by mixing up the new rating and the stored average.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

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.

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.

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.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

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.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.