$HTTP_POST_VARS vs $_POST

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 ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-03-2005
Hendry Taylor
 
Posts: n/a
Default $HTTP_POST_VARS vs $_POST

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
Reply With Quote
  #2 (permalink)  
Old 12-04-2005
Connector5
 
Posts: n/a
Default Re: $HTTP_POST_VARS vs $_POST

$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



Reply With Quote
  #3 (permalink)  
Old 12-04-2005
bonfils
 
Posts: n/a
Default Re: $HTTP_POST_VARS vs $_POST

"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


Reply With Quote
  #4 (permalink)  
Old 12-04-2005
Hendry Taylor
 
Posts: n/a
Default Re: $HTTP_POST_VARS vs $_POST

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
>

Reply With Quote
  #5 (permalink)  
Old 12-06-2005
Hilarion
 
Posts: n/a
Default Re: $HTTP_POST_VARS vs $_POST

>>> 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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 09:02 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0