Page 1 of 1

question regarding syntax style in form variables

Posted: Sat Apr 05, 2008 2:02 pm
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.

Re: question regarding syntax style in form variables

Posted: Sat Apr 05, 2008 2:40 pm
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'].

Re: question regarding syntax style in form variables

Posted: Sat Apr 05, 2008 3:32 pm
by thosecars82
thks a lot