[nycphp-talk] What is $QUERY_STRING ?
Chris Shiflett
shiflett at php.net
Tue Mar 11 12:20:29 EST 2003
--- Matthew Zimmerman <mz34 at nyu.edu> wrote:
> I had tried GET, but i was only using print($QUERY_STRING) instead of
> print ($_SERVER['QUERY_STRING']); When I added that it did, as you say,
> bloom.
>
> So what purpose is it serving in this code
>
> > <form action="<?=$PHP_SELF?><?if($QUERY_STRING){ echo"?".
> > $QUERY_STRING;}?>"method="POST">
>
> if the method is POST?
It may seem confusing due to the way PHP names its variables, but a request can
have both GET and POST variables. Your example above is the beginning of a form
that posts the form information to the current page. In case the current page
is http://nyphp.org/blah.php?foo=bar, this code makes sure that the form posts
to blah.php?foo=bar instead of just blah.php.
If you need to use anything in the query string, the $_GET array is populated
with each of the URL variables. You probably already know that, but I thought
I'd mention it.
Chris
More information about the talk
mailing list