TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Tue Apr 13, 2004 8:01 am Post subject: Register Globals - Easy Way! |
|
|
I just wanted to give you all a better way to register globals in your scripts if your a PHP programmer
because I just found this little trick out by reading a book by Larry Ullman "PHP: Visual Quickstart Guide - Second EDition"
Here is a simple way to leave "Register Globals = Off" in your
php.ini file , just do the code that I type , its very neat.
Lets say I want to Register the Variables $name , $email , and $comments , here is the simple
way to do this without typing stuff like $_POST['name']; all the time , just watch !
This will actually Register the variable $name , now
you can use $name as a variable in your code. "Look Below"
The same with the others!
Code: | $name = $_POST['name']; |
Code: | $email = $_POST['email']; |
Code: | $comments = $_POST['comments']; |
Do every variable like this that you want to register and use
$_REQUEST['variable'] or $_GET['variable'] , it all depends
Its just like using $variable = param("variable"); in Perl !
--------------------------------------------------------------------------------------------------
For those of you who don't know why I posted this , new to PHP version
4 , you have to have "Register Globals = On" to use these types of variables
but thanks to my posting , I just gave those of you who don't know , a short
cut to cut time in half when your programming in PHP , Later!
P.S. Im still trying to decide if this should be in the Tutorials forum :? |
|