pass variables from javascript to php with a cookie -
this has been asked before, want can avoid refreshing page caused post , get, , ajax seems right way
but wondering if can make cookie javascript , (from same page) access php. possible?
small example:
//html code: <form name="plform" onsubmit="myfunction()"> <input type="text" name="plname"/> </form> //js part: myfunciton() { var cname = "playlistname"; var cvalue = document.form["plform"]["plname"]; document.cookie = cname + "=" + cvalue; } //in php: <?php $x = $_cookie["playlistname"]; //some code ?>
Comments
Post a Comment