Register Globals - Easy Way!

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Tue Apr 13, 2004 8:01 am    Post subject: Register Globals - Easy Way! Reply with quote

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 :?
Back to top View user's profile Send private message Visit poster's website
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Wed Apr 14, 2004 1:45 pm    Post subject: Re: Register Globals - Easy Way! Reply with quote

TRUSTpunk,

You can find other workarounds in http://www.php.net/register_globals .
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
goose
-


Joined: 17 Sep 2002
Posts: 608
Location: The Land Of OZ! come here toto!

PostPosted: Thu Apr 15, 2004 8:49 pm    Post subject: Reply with quote

hmmm will check these methods out! cheers 8)
_________________
living in an armish paradise.....no gates here!

mawuahahaha :)
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group