Note that there are some explanatory texts on larger screens.

plurals
  1. POcatch data from javascript using json to make a query in PHP
    primarykey
    data
    text
    <p>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,....</p> <p>So i need to "catch" that value.. (using json? or thats what i have been reading here) to finally insert it on the database</p> <p>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.</p> <p>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!!</p> <p>Also I Asume that i can asign an Id or something to send multiple rates from one page, </p> <p>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)</p> <p>this is the code from the rating system here <a href="http://reignwaterdesigns.com/ad/tidbits/rateme/" rel="nofollow">http://reignwaterdesigns.com/ad/tidbits/rateme/</a></p> <pre><code>/* 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&lt;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&lt;=sMax; i++){ if(i&lt;=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&lt;=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); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload