Re: php-db globals turned off

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

 



Mignon Hunter wrote:
How do most of you handle variables in next page after passing.

For instance. What I have right now (very ugly) is:

$email = $_POST['emal'];
$first = $_POST['first'];
$lastl = $_POST['last'];

Then I work with $email, $first etc...

I will have to do this for many, many variables which doesnt seem very efficient.

I tried:

foreach ($_POST as $key => $value)
$key =  $value;

but that didnt work...but I can print them out.

This should be $$key = $value, but that's not the way to do it.


but even if this did work - this wouldnt handle the 2 sets of arrays I have.

If you really want to do this use http://php.net/extract but bear in mind that doing this is making having register_globals off fairly pointless since this is basically what register_globals does before your script is executed. If you're going to work with them off, work with them off.


What's wrong with using the superglobals ($_POST, $_GET, etc) throughout your script?

--
Stuart

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux