At the moment I have this, but I want to change it to one switch button

<a href="<?php echo $_SERVER['PHP_SELF'];?>?session_switch=1">switch it</a>. 
I

 have tried but keep getting wrapped up in nested if-else statements. Does 
anyone know how to make an efficient one button on-off switch.



<?
 $session_switch = isset($_GET['session_switch']) ? $_GET['session_switch'] 
: 0;
 if ($session_switch==1) {
 echo "on";
 ?>
//do something here

<?
}
else {

//do something else

}
?>

<a href="<?php echo $_SERVER['PHP_SELF'];?>?session_switch=0">off</a>
<a href="<?php echo $_SERVER['PHP_SELF'];?>?session_switch=1">on</a>

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

Reply via email to