Re: No Global Code Fixing
| From: | Jason Sheets | Date: | Sat, 04 Jan 2003 18:59:05 +0000 |
| Subject: | Re: No Global Code Fixing | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130250@lists.php.net to get a copy of this message | ||
If you do that you might as well just turn on register globals, you
should look at the $_REQUEST variable, it combines $_POST, $_GET and
$_COOKIE into one array so you can just reference $_REQUEST['variable']
for example $_REQUEST['one'].
Jason
On Sat, 2003-01-04 at 11:50, Michael J. Pawlowsky wrote:
>
> I just found a better answer, but still open to suggestions....
>
> with the URI :
> http://rc.mikeathome.net/test/index.php?one=1&two[]=2&two[]=3&three=3&key=This%20is%20the%20key
>
> I tried this:
>
>
> <?php
>
> if (isset($_GET)){
> foreach($_GET as $key => $value){
> ${$key}=$value;
> }
> echo $one;
> echo "<br>";
> print_r($two);
> echo "</br>";
> echo $three . "<br>\n";
> echo $key;
> }
>
> ?>
>
> Result:
> -------------------------------------------------
> 1
> Array ( [0] => 2 [1] => 3 )
> 3
> This is the key
> ------------------------------------------------
>
>
> And that actually worked....... I can live without the unset()'s.
> Just need to add the same for POST and do an include with it.
>
> Anyone have a better idea?
>
>
>
> *********** REPLY SEPARATOR ***********
>
> On 04/01/2003 at 1:22 PM Michael J. Pawlowsky wrote:
>
> >
> >So just wondering if anyone had something really elegant to replace it.
> >
> >
> >Cheers,
> >Mike
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php