SESSION

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
madu
Forum Commoner
Posts: 32
Joined: Sat Dec 25, 2010 3:19 am
Location: india

SESSION

Post 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
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: SESSION

Post by Benjamin »

All pages using sessions must call session_start();
madu
Forum Commoner
Posts: 32
Joined: Sat Dec 25, 2010 3:19 am
Location: india

Re: SESSION

Post by madu »

i used session_start() function in redirected page,,,still didnt solve problem
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: SESSION

Post by Benjamin »

You can't start a session after headers are sent. Do you have error reporting enabled?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: SESSION

Post by Benjamin »

:arrow: Use

Code: Select all

 tags when posting code in the forums.
Post Reply