473,406 Members | 2,369 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Using $_POST or $HTTP_POST_VARS etc. ?

Hi there,

I am using in principal the $HTTP_xxx_VARS since quite a while and have, because it seemed the $_POST was newer and "more efficient" slightly changed that little script which is running on my site:

[PHP]if (sizeof($_POST) > 0)
$HTTP_FORM_VARS = $_POST;
elseif (sizeof($_GET) > 0)
$HTTP_FORM_VARS = $_GET;
else
$HTTP_FORM_VARS = array("");
[/PHP]

Nevertheless, it seems when used in functions, $_POST is readable without problem whereas $HTTP_FORM_VARS isn't... Perhaps it's a problem of my script? Should I use $_POST generally?

Thanks for any advice!
Jul 2 '08 #1
3 3021
chromis
113 100+
As far as I know $HTTP_POST_VARS etc are deprecated for php versions below 4.1.0. $_POST was introduced in this version. This link may help you some more:

http://hasin.wordpress.com/2006/06/10/difference-between-_xxx-and-http_xxx_vars/

Hope this helps.

Chromis
Jul 2 '08 #2
Markus
6,050 Expert 4TB
Should I use $_POST generally?
Yes. Yes. Yes!

$_HTTP_blah is deprecated, as someone already mentioned. Therefore, should not really be used.
Jul 2 '08 #3
r035198x
13,262 8TB
...
Nevertheless, it seems when used in functions, $_POST is readable without problem whereas $HTTP_FORM_VARS isn't... Perhaps it's a problem of my script? Should I use $_POST generally?

Thanks for any advice!
The reason is because $_POST is a superglobal while those old things are just globals.
Why not just replace references to those old things rather than aliasing them like you are trying to do? Also ensure that you've set register globals to off after removing those things from your code.
Jul 2 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: brianj | last post by:
Apache/2.0.48 (Win32) PHP/4.3.6 I would like to take a value from a checkbox(checked or unchecked) and then use that value in a php script All on the same page. So I should post the form to the...
0
by: Shannon Wright | last post by:
I am trying to request form elements from a form from a page that looks like this: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html;...
0
by: NotGiven | last post by:
Below is a code snippet I am having a hard time with. I rerquire code1.php and code 2.php. code1.php contains some variables the code needs. code2.php contains some functions I call from the...
2
by: WindAndWaves | last post by:
SHould I write $HTTP_POST_VARS or $HTTP_POST_VARS or $HTTP_POST_VARS It seems that both of them (with or without quotes) work... Sorry I am sure this is a very stupid question... - Nicolaas
10
by: arun.kumar.varma | last post by:
Hi, I'm learning PHP and prepared a simple login form. validate.php does the validation and it was behaving erratically. So, I did var_dump of $_POST variable and it's NULL. Did I miss anything...
1
by: frey | last post by:
the code is used for repost $HTTP_POST_VARS from a form to the insert page at the "preview" page <?php /* Re-Post all POST'ed variables */ reset($HTTP_POST_VARS); while (list($key, $value) =...
14
by: Sergei Riaguzov | last post by:
I have a very strange behaviour with POST keys. Consider a test: wtf.html: === Cut === <form action="eh.php" method="POST">     <input type="checkbox" name="many spaces and. . dots. . "/>...
10
by: sufian | last post by:
I am new to the world of PHP. Below is my simple PHP file "invite.php" with a form having an image send button (I have to use the image send button because it is the requirement, may be this is...
2
by: amolbehl | last post by:
Hi I am trying to understand a script and it has the following <?php $postArray = array(); if ( isset( $_POST ) ) { $postArray = &$_POST ; // 4.1.0 or later, use $_POST } else
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.