Hi I am new to this forum and hoping someone could help I have set a dropdown menu with option value dynamically pulling in from a mysql database. these values when selected use xml to return the ids and content according to whats been selected. In the url there is a variable which im having trouble getting PHP to create a session variable from it. Can this be done? Thanks
Thanks, this is the code where the url is set
function showUser(str)
{
var xmlhttp;
if (str.length==0)
{
document.getElementById("state").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("state").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getuser.php?q="+str,true);
xmlhttp.send(null);
}
The php call '$id = $_GET['q']; $_SESSION['q'] = $id;'
showUser()function is called the element with idstatewill have innerHTML updated with data recieved from PHP. Session variable should be also set, but this will take effect (in PHP) after page is reload.