views:

109

answers:

4

Possible Duplicate:
Stack Overflow / reddit voting system in php

How do voting systems, like the one here at SO, work? I would like to implement a voting system on my web page (coded in php), but dont want to have to force the user to post a form to vote and update the database. I would like it so when a user clicks a thumbs up, on a comment as an example, the database would automatically update the "reputation" of that comment. Is there any way to accomplish this in php? What would you guys reccomend?

+2  A: 

The basic technique is called Ajax. You can't exactly "do it in PHP", though PHP can be used as part of the process. The Ajax code itself is in JavaScript. More specifically, SO uses the Ajax support built into jQuery.

chaos
+1  A: 

You need to use AJAX. Read this to have an example on how to implement a digg-like voting functionality.

Max
+1  A: 

Read up on Ajax. Essentially, you'd be using Javascript to handle the form submissions and get back responses in the background, then modifying the page based on that.

matthock
A: 

Check this tutorial: Reddit-style Voting With PHP, MySQL And jQuery

Shoban