[PHP] Getting values for posted form in HASH array rather than just variables.

2001-02-19 Thread Matthew Toledo

SUBJECT: Getting values for posted form in HASH array rather than just
variables.

I've been using perl for a while and am just starting with PHP.  I like it.

Is there an array that holds all the information that was submitted via a
FORM post or get.

I know that PHP automatically creates variables that are named after the
name of the INPUT tag on the HTML form.  But what if I don't know what the
names of the input tags are?

Are they stored in a HASH array as well?

What is the name of the array?

I.E. in perl, if you use cgi-lib.pl, all the form elements are stored in a
HASH array called %in.  You don't need to know the names of the input tags
to get the data from them.

HTML HAS...
input name="joe" type="text
input name="alice type="text

PERL Example.
# library for handling CGI in
require 'cgi-lib.pl';

# get all the info from the form,
# put it in HASH array called %in
ReadParse();

foreach $key (sort keys %in) {
print $in{$key};
}

PHP EXAMPLE...
# is there a hash array equivalent of %in like in the perl above?



===
Matthew Toledo
FrogNet Design  Domain Management
[EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Getting values for posted form in HASH array rather than just variables.

2001-02-19 Thread David Robley

On Tue, 20 Feb 2001 08:56, Matthew Toledo wrote:
 SUBJECT: Getting values for posted form in HASH array rather than just
 variables.

 I've been using perl for a while and am just starting with PHP.  I like
 it.

 Is there an array that holds all the information that was submitted via
 a FORM post or get.

 I know that PHP automatically creates variables that are named after
 the name of the INPUT tag on the HTML form.  But what if I don't know
 what the names of the input tags are?

 Are they stored in a HASH array as well?

 What is the name of the array?

 I.E. in perl, if you use cgi-lib.pl, all the form elements are stored
 in a HASH array called %in.  You don't need to know the names of the
 input tags to get the data from them.

 HTML HAS...
 input name="joe" type="text
 input name="alice type="text

 PERL Example.
 # library for handling CGI in
 require 'cgi-lib.pl';

 # get all the info from the form,
 # put it in HASH array called %in
 ReadParse();

 foreach $key (sort keys %in) {
 print $in{$key};
 }

 PHP EXAMPLE...
 # is there a hash array equivalent of %in like in the perl above?

Check out the section of the manual on PHP Variables (in the Variables 
chapter 7)

HTTP_POST_VARS and HTTP_GET_VARS will be the ones you are looking for - 
oh and possibly HTTP_COOKIE_VARS.

-- 
David Robley| WEBMASTER  Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet| http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]