Re: using BOTH GET and POST in the same page.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ashim Kapoor wrote:
Dear All,

I am reading "PHP5 and MySQL Bible". Chapter 7 of the book says that PHP can
use GET and POST in the SAME page! Also it says that we can use the SAME
variables in GET and POST variable sets and that conflict resolution is done
by variable_order option in php.ini Can some one write a small program to
illustrate the previous ideas?  It is not clear to me as to how to implement
this.

I noticed you've already received one response, so here's some more background info.

It's using $_GET and $_POST in the same script, not HTTP GET and HTTP POST. $_GET in PHP correlates to the query string parameters in the URL requested, $_POST in PHP correlates to form data which is POSTed to the server inside a message, with the type application/x-www-form-urlencoded.

One could say that $_GET and $_POST are named misleadingly, and that infact what you have is $_PARSED_QUERY_STRING_FROM_URL and $_POST_DATA_MAYBE .

The two are quite separate and can both be used at the same time.

HTML forms allow a method to be set, GET or POST, if GET then the form is treated like an URL construction template, if POST then it's treated like a message body construction template.

It's worth reading up on both HTTP and HTML Forms when using PHP, since PHP is a "Pre Hypertext Processor" and HTTP is the Hypertext transfer protocol, and HTML is the Hypertext markup language :)

Best,

Nathan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux