473,551 Members | 2,722 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 26898
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.variab les.php>
<URL:http://www.php.net/manual/en/language.variab les.predefined. php>

Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "supergloba l". 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(htmlentiti es($_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********@jim dabell.com> wrote in message news:<fP******* *************@g iganews.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.variab les.php>
<URL:http://www.php.net/manual/en/language.variab les.predefined. php>

Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "supergloba l". 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(htmlentiti es($_REQUEST['foo']));

?>

Jul 17 '05 #3

[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jim dabell.com> wrote in message
news:<fP******* *************@g iganews.com>... [snip]
Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "supergloba l". 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********@jim dabell.com> wrote in message news:<DP******* *************@g iganews.com>...
[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jim dabell.com> wrote in message
news:<fP******* *************@g iganews.com>...

[snip]
Basically, $HTTP_POST_VARS[] is just a normal array that is initially
populated by PHP, and $_POST[] is a "supergloba l". 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*****@norwaym i.com (Phrylock) wrote in message news:<dc******* *************** ****@posting.go ogle.com>...
Jim Dabell <ji********@jim dabell.com> wrote in message news:<DP******* *************@g iganews.com>...
[Please don't post upside-down]

Phrylock wrote:
Jim Dabell <ji********@jim dabell.com> wrote in message
news:<fP******* *************@g iganews.com>... [snip]> Basically, $HTTP_POST_VARS[] is just a normal array that is initially
> populated by PHP, and $_POST[] is a "supergloba l". 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
3179
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 $HTTP_GET_VARS in a class, but I can't get it to work. Note the following php page, which creates an object that pulls the "param" parameter in both the class...
5
6094
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 downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you...
2
2410
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
4342
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? Regards,
1
2461
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 $_GET, this gives:- select * from tickets where ( status=''Closed'' ...... If I look at $HTTP_GET_VARS, this gives:-
3
1360
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. <form method="POST" action="scripts/WebContractor.php" name="bizinfo" id="bizinfo"> Since most of this is new to me, please let me ramble in my...
0
1567
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
2615
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 considerable amount of work to change everything, can I safely leave things as they are? TIA.
4
10653
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, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status,...
0
7492
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7768
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8002
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7847
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6106
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5406
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5130
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1981
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
804
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.