1
Contributor
1
Reply
6
Views
6 Years
Discussion Span
Last Post by karthik_ppts
0

I'm using AJAX to set session and my problem is solved.

<script type="text/javascript">
	function setLeft(str)
	{
		if (window.XMLHttpRequest)
		{// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp=new XMLHttpRequest();
		}
		else
		{// code for IE6, IE5
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange=function()
		{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
			{
				if(str=="hide")
				{
					document.getElementById("left_side").style.display='none';
					document.getElementById("left_side_show").style.display='';
				}
				if(str=="show")
				{
					document.getElementById("left_side").style.display='';
					document.getElementById("left_side_show").style.display='none';
				}
			}
		}
		xmlhttp.open("GET","setSession.php?q="+str,true);
		xmlhttp.send();
	}
</script>

setSession.php

<?php
	@session_start();
	$_SESSION["ses_left"]=$_GET["q"];
?>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.