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

From: Date: Sat, 12 Feb 2011 19:56:13 +0000
Subject: Re: using BOTH GET and POST in the same page.
References: 1  Groups: php.general php.general 
Request: Send a blank email to php-general+get-311256@lists.php.net to get a copy of this message
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

« previous php.general (#311256) next »