Surveying framework or Voting framework is extremely regular in sites. Voting could be about your website or site or some other thing simply to get the client consideration and get your thought regarding your item.
Database Structure
Copy this db structure as it is and paste in your mysql window.
CREATE TABLE IF NOT EXISTS `polling` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`liked` int(11) NOT NULL,
`dislike` int(11) NOT NULL,
`average` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
—
— Dumping data for table `polling`
—
INSERT INTO `polling` (`id`, `liked`, `dislike`, `average`) VALUES
(1, 1, 1, 1);
CREATE TABLE IF NOT EXISTS `polling_ip` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userip` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
JQUERY CODE
// <![CDATA[
$(document).ready(function() {
$(‘.totalstatsbutton’).livequery(“mouseenter”, function(e){
$(‘.tooltip3’).show();
$(‘.totalstats’).fadeIn(200);
}).livequery(“mouseleave”, function(e){
$(‘.tooltip3’).hide();
$(‘.totalstats’).fadeOut(200);
});
});
$(document).ready(function(){
$(‘#Send’).click(function(){
var vote = $(“input[@name=’radio_name’]:checked”).val();
showLoader();
$.post(“voting.php?value=”+vote,{
}, function(response){
hideLoader();
$(‘#wrap’).html(unescape(response));
});
});
//show loading bar
function showLoader(){
$(‘.search-background’).fadeIn(200);
}
//hide loading bar
function hideLoader(){
$(‘.search-background’).fadeOut(200);
};
});
Reblogged this on Sutoprise Avenue, A SutoCom Source.
Found very usefull and informative, Please follow another tutorial on Polling and Survey System in PHP, Mysql, AJAX
http://www.discussdesk.com/Polling-and-survey-system-in-php-mysql.htm