Reputation: 23
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;'
Upvotes: 0
Views: 65
Reputation: 137
Do you mean this?
http://www.domain.com/?action=delete
$action = $_GET['action'];
$_SESSION['action'] = $action;
Upvotes: 1