Hello im using a code from a javascript tutorial wich works great.. its a rating star system, so i can ask my users, your skills on something and they can "answer" using this rating system,....
So i need to "catch" that value.. (using json? or thats what i have been reading here) to finally insert it on the database
Can i store this value on the $_SESSION?.. because that would be great as im using a steps formulary,.... each step storing variables in the session so at the last step i insert all using php in the mysql database.
As you will see the data is ready to bee send :D thats great but , how do i catch it , and store it in the $_SESSION. thanks in advance!!
Also I Asume that i can asign an Id or something to send multiple rates from one page,
this is not specified on the code, and im pretty bad actually with javascript.. (thats why i ask to all the wisdom people on stackoverlflow)
this is the code from the rating system here http://reignwaterdesigns.com/ad/tidbits/rateme/
/*
Author: Addam M. Driver
Date: 10/31/2006
*/
var sMax; // Isthe maximum number of stars
var holder; // Is the holding pattern for clicked state
var preSet; // Is the PreSet value onces a selection has been made
var rated;
// Rollover for image Stars //
function rating(num){
sMax = 0; // Isthe maximum number of stars
for(n=0; n<num.parentNode.childNodes.length; n++){
if(num.parentNode.childNodes[n].nodeName == "A"){
sMax++;
}
}
if(!rated){
s = num.id.replace("_", ''); // Get the selected star
a = 0;
for(i=1; i<=sMax; i++){
if(i<=s){
document.getElementById("_"+i).className = "on";
document.getElementById("rateStatus").innerHTML = num.title;
holder = a+1;
a++;
}else{
document.getElementById("_"+i).className = "";
}
}
}
}
// For when you roll out of the the whole thing //
function off(me){
if(!rated){
if(!preSet){
for(i=1; i<=sMax; i++){
document.getElementById("_"+i).className = "";
document.getElementById("rateStatus").innerHTML = me.parentNode.title;
}
}else{
rating(preSet);
document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML;
}
}
}
// When you actually rate something //
function rateIt(me){
if(!rated){
document.getElementById("rateStatus").innerHTML = document.getElementById("ratingSaved").innerHTML + " :: "+me.title;
preSet = me;
rated=1;
sendRate(me);
rating(me);
}
}
// Send the rating information somewhere using Ajax or something like that.
function sendRate(sel){
alert("Your rating was: "+sel.title);
}