I made this simple ajax star rating for my latest poject. And now i want to share it to you. Let’s start it :D.
Step 1 : CSS Star Rater
First thing is the star rater. I got this cool ‘css star rater’ from http://www.komodomedia.com/ . I assumed that we already understood how to use it, so we will not talk too much about this ‘css star rater’.
Step 2 : Create MySQL table
Next is create table (using MySQL) to store the data. You can copy the script below
CREATE TABLE IF NOT EXISTS
counter int(8) NOT NULL default ‘0’,
value int(8) NOT NULL default ‘0’
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Step 3 : PHP
After finished create table, then we can start create some php code to handle input, update and retrieve data from the database, here is the code. I added some important comment in it
Don’t forget to link the jquery library into your document
Step 5 : Put it all together
That’s it! :D. You can add some modification like notification, or loader while processing.
– Download zip file jQuery Tutorial : Simple ajax star rating with php (12642)
This article inspired by http://www.yvoschaap.com/