473,426 Members | 1,690 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,426 software developers and data experts.

HTTP_POST and HTTP_GET_VARS

I am a beggining PHP developer (been doing it for like 3 weeks now)
and I am currently having a problem getting these arrays to work. I am
running PHP 4.3.4 with Apache 2.0.47 on WinXP. I have a pretty good
idea as to how they work, but no clue on how to apply them to the PHP
scripts that I have written. (I'm not sure how to code it in properly,
and have been stuck on this problem for a few days now) Could some one
please advise me on this matter? (preferably soon?!?) Due to the
differences I have spotted amongst the versions of PHP out there, I am
not sure what the format is for the code.
~Greatful for any help!
~Phry
Jul 17 '05 #1
5 26887
Phrylock wrote:
I am a beggining PHP developer (been doing it for like 3 weeks now)
and I am currently having a problem getting these arrays to work. I am
running PHP 4.3.4 with Apache 2.0.47 on WinXP.

[snip]

The manual is your first stop:

<URL:http://www.php.net/manual/en/reserved.variables.php>
<URL:http://www.php.net/manual/en/language.variables.predefined.php>

Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "superglobal". Don't bother using
$HTTP_POST_VARS[] unless you absolutely have to use an old version of PHP
or something. The same applies to the other predefined arrays such as
$_GET[] and $HTTP_GET_VARS[].

For example:

<?php

echo(htmlentities($_REQUEST['foo']));

?>
--
Jim Dabell

Jul 17 '05 #2
So, let say I have an HTML page with drop menus, text boxes, and a
submit button. 1 menu is for selecting a species of wood (6 types for
my purposes), thus 6 options and the variable is known as Species, the
next menu is size, and there are 24 options there (variable name =
size), then the next thing is a text box for quantity to order,
numeric, (variable = qty), then finally the user has to select a state
to add the corresponding state taxes, (Variable= State), how do I get
these variables to be read in PHP 4.3.4 then, without using the affor
mentioned Array methods?

Thanks,
Andy

Jim Dabell <ji********@jimdabell.com> wrote in message news:<fP********************@giganews.com>...
Phrylock wrote:
I am a beggining PHP developer (been doing it for like 3 weeks now)
and I am currently having a problem getting these arrays to work. I am
running PHP 4.3.4 with Apache 2.0.47 on WinXP.

[snip]

The manual is your first stop:

<URL:http://www.php.net/manual/en/reserved.variables.php>
<URL:http://www.php.net/manual/en/language.variables.predefined.php>

Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "superglobal". Don't bother using
$HTTP_POST_VARS[] unless you absolutely have to use an old version of PHP
or something. The same applies to the other predefined arrays such as
$_GET[] and $HTTP_GET_VARS[].

For example:

<?php

echo(htmlentities($_REQUEST['foo']));

?>

Jul 17 '05 #3

[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jimdabell.com> wrote in message
news:<fP********************@giganews.com>... [snip]
Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "superglobal". Don't bother using
$HTTP_POST_VARS[] unless you absolutely have to use an old version of PHP
or something. The same applies to the other predefined arrays such as
$_GET[] and $HTTP_GET_VARS[].

[snip] So, let say I have an HTML page with drop menus, text boxes, and a
submit button. 1 menu is for selecting a species of wood (6 types for
my purposes), thus 6 options and the variable is known as Species, the
next menu is size, and there are 24 options there (variable name =
size), then the next thing is a text box for quantity to order,
numeric, (variable = qty), then finally the user has to select a state
to add the corresponding state taxes, (Variable= State), how do I get
these variables to be read in PHP 4.3.4 then, without using the affor
mentioned Array methods?


Use the $_REQUEST[] like I showed you in the example. It's just an array
you can access from anywhere in your scripts. It is populated by PHP
automatically, you don't have to worry about getting the values into the
array, you just have to use it. For instance:

index.html:

[...]
<form action="process.php" method="post">
<input type="text" name="qty">
<input type="submit">
</form>
[...]

process.php:

[...]
<?php

echo('You ordered ' . htmlentities($_REQUEST['qty']) . ' items.');

?>
[...]

--
Jim Dabell

Jul 17 '05 #4
Jim Dabell <ji********@jimdabell.com> wrote in message news:<DP********************@giganews.com>...
[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jimdabell.com> wrote in message
news:<fP********************@giganews.com>...

[snip]
Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "superglobal". Don't bother using
$HTTP_POST_VARS[] unless you absolutely have to use an old version of PHP
or something. The same applies to the other predefined arrays such as
$_GET[] and $HTTP_GET_VARS[].

[snip]
So, let say I have an HTML page with drop menus, text boxes, and a
submit button. 1 menu is for selecting a species of wood (6 types for
my purposes), thus 6 options and the variable is known as Species, the
next menu is size, and there are 24 options there (variable name =
size), then the next thing is a text box for quantity to order,
numeric, (variable = qty), then finally the user has to select a state
to add the corresponding state taxes, (Variable= State), how do I get
these variables to be read in PHP 4.3.4 then, without using the affor
mentioned Array methods?


Use the $_REQUEST[] like I showed you in the example. It's just an array
you can access from anywhere in your scripts. It is populated by PHP
automatically, you don't have to worry about getting the values into the
array, you just have to use it. For instance:

index.html:

[...]
<form action="process.php" method="post">
<input type="text" name="qty">
<input type="submit">
</form>
[...]

process.php:

[...]
<?php

echo('You ordered ' . htmlentities($_REQUEST['qty']) . ' items.');

?>
[...]


Thanks Man! I will try this first thing monday morning. Hopefully it
leads me somewhere, will keep you posted!
Jul 17 '05 #5
Hey,
Good news! I finally got it to work, and work well for me... Thanks
for all your help.

~Phry

no*****@norwaymi.com (Phrylock) wrote in message news:<dc**************************@posting.google. com>...
Jim Dabell <ji********@jimdabell.com> wrote in message news:<DP********************@giganews.com>...
[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jimdabell.com> wrote in message
news:<fP********************@giganews.com>... [snip]> Basically, $HTTP_POST_VARS[] is just a normal array that is initially
> populated by PHP, and $_POST[] is a "superglobal". Don't bother using
> $HTTP_POST_VARS[] unless you absolutely have to use an old version of PHP
> or something. The same applies to the other predefined arrays such as
> $_GET[] and $HTTP_GET_VARS[]. [snip] So, let say I have an HTML page with drop menus, text boxes, and a
submit button. 1 menu is for selecting a species of wood (6 types for
my purposes), thus 6 options and the variable is known as Species, the
next menu is size, and there are 24 options there (variable name =
size), then the next thing is a text box for quantity to order,
numeric, (variable = qty), then finally the user has to select a state
to add the corresponding state taxes, (Variable= State), how do I get
these variables to be read in PHP 4.3.4 then, without using the affor
mentioned Array methods?


Use the $_REQUEST[] like I showed you in the example. It's just an array
you can access from anywhere in your scripts. It is populated by PHP
automatically, you don't have to worry about getting the values into the
array, you just have to use it. For instance:

index.html:

[...]
<form action="process.php" method="post">
<input type="text" name="qty">
<input type="submit">
</form>
[...]

process.php:

[...]
<?php

echo('You ordered ' . htmlentities($_REQUEST['qty']) . ' items.');

?>
[...]


Thanks Man! I will try this first thing monday morning. Hopefully it
leads me somewhere, will keep you posted!

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ben Hall | last post by:
Hey guys, I'm building a web application in php for the first time (I like php a lot..) and have come across a litle stumbling block. I want to access a passed url parameter with...
5
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily...
2
by: John Pastrovick | last post by:
I am new to PHP, coming from ASP coding if (HTTP_GET_VARS==1){ print "Yes"; }else{ print "No"; } when "b" is not passed via (http://www.mydomain.com?b=1
4
by: Sims | last post by:
Hi, Is it wrong to forcefully set a value HTTP_GET_VARS and HTTP_POST_VARS $HTTP_GET_VARS = 'bar'? If yes, why? and how can i pass value between one page and the other without using the url?...
1
by: Chris Cox | last post by:
Hi, Hoping someone can help, I have a sql query which is passed to the script via the url, this is like:- &stmt=select%20*%20from%20table%20where%20(%20status!='Closed'%20..... If I look at...
3
by: danny | last post by:
Hi, I have a form which needs posting the php script below. (I sent my vars to a cookie, which I have read correctly). This is the form command used in hoping to process my information. ...
0
by: odysseyphotography | last post by:
Hi, I'm trying to build a simple search for a database of jobs. Users can search using three groups of critera: 1) Area (check boxes) Buying and merchandising Design Executive
3
by: joboils | last post by:
I've inherited a huge, rambling site with numerous lines containing $_SERVER php.net says it should be single inverted commas, not double, yet everything seems to work. As it would be a...
4
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.