Create PHP session variable inside Kinetic.js/Javascript -


i trying create php session variable inside of kinetic.js/javascript.

stage.on('mousedown', function(evt) {   var shape = evt.targetnode;   if (shape) {     if (shape.getfill() == 'green') {        //$_session['room_name'] = shape.getattr('key');       window.location.href = 'create.php';     }          } }); 

when shape clicked, want session variable store 'key' attribute, string, go 'create.php'.

how can this?

edit: cerbrus, tried suggestion:

stage.on('mousedown', function(evt) {   var shape = evt.targetnode;   if (shape) {     if (shape.getfill() == 'green') {        var img = new image();       img.src = "script.php?roomname=" + encodeuricomponent('hello');       window.location.href = 'create.php';     }          } }); 

the user sent 'create.php', when tried print in 'create.php':

<?php   echo $_get['roomname']; ?>  

nothing echoed

you have set roomname parameter in url can read php script.

window.location.href = 'create.php?roomname='+ encodeuricomponent('hello'); 

you can same send id.

window.location.href = 'create.php?roomname='+shape.getattr('key'); 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -