
August 29th, 2006, 09:00 PM
|
|
|
|
Join Date: Apr 2007
Posts: 11
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
gracefull way to declare $_REQUEST, and $_SESSION vars
Hello,
I'm migrating some sites to a new server that has PHP 5 installed on it and I'm changing all my old code to be compatable w/ PHP5.
My question is that it seems that PHP5 requires that you declare your global vars before you use them.
I you set your $_REQUEST vars at the beginning of the page you nix them when the page is submitted via a form.
Here's an example:
Code:
<?
#---- declare vars -------------------
$_REQUEST['username'] = '';
$_REQUEST['password'] = '';
#---------------------------------------
echo "<p> username: " . $_REQUEST['username'] . " password: " . $_REQUEST['password']; // once the form is submitted the above declaration will reset the set request variables
?>
How would you get around this?
Thanks,
Clem C.
|