I think the best option you have is to make an AJAX
request with the values. With this you can send and assign the values to your PHP variables
.
Else you can use COOKIE
etc. to store the value temporarily and then use it on server side whenever a server side function is called next.
Ajax code
<script type='text/javascript'>
function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (err2) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (err3) {
req = false;
}
}
}
return req;
}
var http = getXMLHTTPRequest();
function sendValue() {
var myurl = "session.php"; // to be present in the same folder
var myurl1 = myurl;
var value = document.getElementById('urDIV').value;
myRand = parseInt(Math.random()*999999999999999);
var modurl = myurl1+"?rand="+myRand+"url"+value ; // this will set the url to be sent
http.open("GET", modurl, true);
http.onreadystatechange = useHttpResponse;
http.send(null);
}
function useHttpResponse() {
if (http.readyState == 4) {
if(http.status == 200) {
var mytext = http.responseText;
// I dont think u will like to do any thing with the response
// Once you get the response, you are done.
}
}
else {
// don't do anything until any result is obtained
}
}
</script>
HTML Part
// considering you are calling on a button call
<input type='button' onclick='sendValue();'>