question regarding syntax style in form variables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

question regarding syntax style in form variables

Post by thosecars82 »

I have read that there are 3 choices of syntax style for form variables depending on the php version you are running and depending on how is your register_globals parameter set:

$variable

$_POST['variable']

$HTTP_POST_VARS['variable']

I would appreciate if anybody could tell me where i can find and modify this parameter manually to activate each of these choices of syntax. Moreover, I think it might be useful to be able to decide dynamically the type of syntax you must use in your code to access form variables. Furthermore, this would make it easy to migrate the code between different php versions. I guess developers will use something like this, right? For that reason it would be great if somebody could tell me if there is an easy way to do it.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: question regarding syntax style in form variables

Post by onion2k »

Never use register_globals, it's a security risk and it's switched off on most hosts (as well as being off by default in PHP 5 and 6). So $variable is out of the question. $HTTP_POST_VARS['variable'] is the old name for the POST superglobal, it'll work but it's been replaced by $_POST in PHP 6 ... so always use $_POST['variable'].
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

Re: question regarding syntax style in form variables

Post by thosecars82 »

thks a lot
Post Reply