Re: Variable formatting problem using sessions...

From: Date: Tue, 27 Jan 2009 01:48:44 +0000
Subject: Re: Variable formatting problem using sessions...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-287198@lists.php.net to get a copy of this message
Rick Duval wrote:
I'm using an "OnClick" routine to set a session variable before I go to another page. onClick=<?php $_SESSION['local_part']= 'rick'; ?> works fine but I need a variable where "rick" is I've tried onClick=<?php $_SESSION['local_part']= $local_part; ?> and other variations but it doesn't work. Can anybody tell me what the proper formatting is to get this to resolve correctly?
Not sure what you're trying to do exactly, but if you're trying to get the 'onClick' to set the $_SESSION['local_part'] variable, it won't. onClick is handled by your browser. PHP runs from the server and has no idea what your browser is doing. You either need to do an ajax call to connect to the server, set the session var, then do the page redirect - or use a get variable and use that on the next page. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#287198) next »