Re: setting a session with a text link?

From: Date: Mon, 21 Aug 2006 16:13:20 +0000
Subject: Re: setting a session with a text link?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-240952@lists.php.net to get a copy of this message
On Mon, August 21, 2006 7:08 am, Ross wrote: > I want to set a session with a text link, am having problems with the > syntax. The link swiches the session to on or off. > > > <a href="" class="link_text">swtich off</a> > href="" class="link_text">swtich on</a> > > I want to do this but the syntax is incorrect. > > <?=$_SERVER['PHP_SELF']?$_SESSION['switch]='0'; ?> > <?=$_SERVER['PHP_SELF']?$_SESSION['switch]='1'; ?> > > what is the correct syntax for this line? something like... <?php $session_switch = isset($_GET['session_switch']) ? $_GET['session_switch'] : 1; $session_switch = (int) $session_switch; if ($session_switch){ session_start(); } ?> <a href="<?php echo $_SERVER['PHP_SELF'];?>?session_switch=0">off</a> <a href="<?php echo $_SERVER['PHP_SELF'];?>?session_switch=1">on</a> -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#240952) next »