Re: setting a session with a text link?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux