On Sun, Feb 13, 2011 at 02:25:45PM -0500, tedd wrote:

> At 10:53 AM +0530 2/12/11, 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.
> >
> >Many thanks,
> >Ashim.
> Ashim:
> What others have not addressed is that the form used to send
> variables will send only GET OR POST method variables, but not both
> at the same time.
> Using REQUEST will show the values of the variables sent, but will
> not show what method was used (not addressing COOKIE) and that is the
> reason why it's not the best idea to use REQUEST.
> Furthermore, as you point out, conflict resolution is done in
> accordance with variable order as set in the php.ini file and that
> can be different between different environments. As such, a script
> can act differently and there in lies the problem.
> Now, I have used scripts that may receive POST or GET variables and
> act accordingly, but you will never (except possibly AJAX) have a
> situation where a script will receive both sets of variables at the
> same time. So, I don't think one can write a small simple script that
> can demonstrate this.

I'm sure I must be misunderstanding something here. The following is a
script which will show both GET and POST being received by the script,
and with the same variable names but different values:


print "GET:<br/>\n";
print "<br/>\n";
print "POST:<br/>\n";

<form method="post">
<input type="text" name="alfa"/>
<input type="submit" name="submit"


Call this script via test.php?alfa=1234
Call it the first time this way and leave that in the location bar of
your browser. Now fill in the value in the blank with the value 4567.
Press the "submit" button. You will see that $_POST['alfa'] returns
4567, while $_GET['alfa'] returns 1234.

It sounds like you're saying this isn't possible, yet it is. So what am
I missing? Is there an error in my code?


Paul M. Foster

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

Reply via email to