This is a discussion on $HTTP_POST_VARS vs $_POST within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I have some php that has a form and I get some variables from the form I had it coded ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have some php that has a form and I get some variables from the form I
had it coded using $HTTP_POST_VARS but it gave me errors saying "Undefined variable: HTTP_POST_VARS" then I changed it to $_POST and it worked. I do not quite understand the differences and why one works and one does not. I have register_global = Off, I tried it with On but still did not work. I am running solaris 10, apache 2, php 5.0.4. I always believed that the two were the same, just slight different way of coding. Hendry |
|
|||
|
$HTTP_POST_VARS is depreciated in favor of $_POST.
The php.ini setting to enable $HTTP_*_VARS is "register_long_arrays". "Hendry Taylor" <hendry.taylor@btinternet.com> wrote in message news:dmt9gv$m96$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... > I have some php that has a form and I get some variables from the form I > had it coded using $HTTP_POST_VARS but it gave me errors saying > "Undefined variable: HTTP_POST_VARS" then I changed it to $_POST and it > worked. > > I do not quite understand the differences and why one works and one does > not. I have register_global = Off, I tried it with On but still did not > work. > > I am running solaris 10, apache 2, php 5.0.4. > > I always believed that the two were the same, just slight different way > of coding. > > Hendry |
|
|||
|
"Hendry Taylor" <hendry.taylor@btinternet.com> skrev i en meddelelse
news:dmt9gv$m96$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... >I have some php that has a form and I get some variables from the form I > had it coded using $HTTP_POST_VARS but it gave me errors saying > "Undefined variable: HTTP_POST_VARS" then I changed it to $_POST and it > worked. > > I do not quite understand the differences and why one works and one does > not. I have register_global = Off, I tried it with On but still did not > work. > > I am running solaris 10, apache 2, php 5.0.4. > > I always believed that the two were the same, just slight different way > of coding. Strange. I know $HTTP_*_VARS are deprecated, but they should still be working in PHP 5. Check your php.ini file. Could it be that register-long-arrays is set to "off"? http://www.php.net/manual/en/ini.cor...er-long-arrays -- bonfils http://kim.bonfils.com "I think if you know what you believe, it makes it a lot easier to answer questions. I can't answer your question." - George W. Bush |
|
|||
|
I did have register-long-arrays set to off, so I left it like that and
changed them all to the new short version. After I posted I did some more reading and learnt this. bonfils wrote: > "Hendry Taylor" <hendry.taylor@btinternet.com> skrev i en meddelelse > news:dmt9gv$m96$1@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... > >>I have some php that has a form and I get some variables from the form I >>had it coded using $HTTP_POST_VARS but it gave me errors saying >>"Undefined variable: HTTP_POST_VARS" then I changed it to $_POST and it >>worked. >> >>I do not quite understand the differences and why one works and one does >>not. I have register_global = Off, I tried it with On but still did not >>work. >> >>I am running solaris 10, apache 2, php 5.0.4. >> >>I always believed that the two were the same, just slight different way >>of coding. > > > Strange. I know $HTTP_*_VARS are deprecated, but they should still be > working in PHP 5. > > Check your php.ini file. Could it be that register-long-arrays is set to > "off"? > http://www.php.net/manual/en/ini.cor...er-long-arrays > |
|
|||
|
>>> I have some php that has a form and I get some variables from the form I
>>> had it coded using $HTTP_POST_VARS but it gave me errors saying >>> "Undefined variable: HTTP_POST_VARS" then I changed it to $_POST and it >>> worked. >>> >>> I do not quite understand the differences and why one works and one does >>> not. I have register_global = Off, I tried it with On but still did not >>> work. >>> >>> I am running solaris 10, apache 2, php 5.0.4. >>> >>> I always believed that the two were the same, just slight different way >>> of coding. >> >> >> Strange. I know $HTTP_*_VARS are deprecated, but they should still be >> working in PHP 5. >> >> Check your php.ini file. Could it be that register-long-arrays is set to >> "off"? >> http://www.php.net/manual/en/ini.cor...er-long-arrays > > I did have register-long-arrays set to off, so I left it like that and > changed them all to the new short version. After I posted I did some > more reading and learnt this. There's one more difference between $_POST and $HTTP_POST_VARS. The first one is superglobal (you do not have do declare it as "global" in function to use it), and the second one is simply global (you have to use "global" declaration in functions to have access to that array). Hilarion |