Page 1 of 1

SESSION

Posted: Mon Jan 10, 2011 10:45 pm
by madu

Code: Select all

$rt='<script language=javascript>
	function showSelected()
	{
	var show=document.getElementById("ty").options[document.getElementById("ty").selectedIndex].value;
	document.write(show);
	}
</script>';
//echo $rt;
$_SESSION['tab']= $rt;
Hi friends,,,,,
in above code i stored the variable $rt into session,,, but i doesn't give the value in other pages,,, suppose if the variable $rt having the value "student" and i print it ,then it will print student but if i try to access the same session nothing display,,,,,help me

Re: SESSION

Posted: Mon Jan 10, 2011 10:45 pm
by Benjamin
All pages using sessions must call session_start();

Re: SESSION

Posted: Mon Jan 10, 2011 11:19 pm
by madu
i used session_start() function in redirected page,,,still didnt solve problem

Re: SESSION

Posted: Tue Jan 11, 2011 12:15 am
by Benjamin
You can't start a session after headers are sent. Do you have error reporting enabled?

Re: SESSION

Posted: Tue Jan 11, 2011 1:17 am
by Benjamin
:arrow: Use

Code: Select all

 tags when posting code in the forums.