You can use $_REQUEST['foo'] which looks at all Cookie, Post, and Get data. 

switch($_REQUEST['foo'])

You may have to still wrap the whole thing around an isset().

if(isset($_REQUEST['foo']))
{
  switch($_REQUEST['foo'])
...

---John Holmes...

----- Original Message ----- 
From: "Gerard Samuel" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Tuesday, May 14, 2002 10:44 AM
Subject: [PHP] switch and register_globals.


> Just looking for opinions/comments of how others are working with 
> switch() while register_globals is off....
> 
> With register_globals off, switch() has a little handicap.
> ie
> switch($foo)
> {
>     ....
>     break;
> }
> 
> $foo, is now illegal/not set.  So far, I've been using this before 
> switch statements.
> 
> if (isset($_POST['foo']))
> {
>     $foo = $_POST['foo'];
> }
> elseif (isset($_GET['foo']))
> {
>     $foo = $_GET['foo'];
> }
> else
> {
>     $foo = FALSE;
> }
> 
> Works for me.  Ill probably turn it into a function so I dont type as 
> much :)
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to