Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>POST and GET (as HEAD, FILE, DELETE etc.) are HTTP <a href="http://www.w3.org/Protocols/HTTP/Methods.html" rel="nofollow noreferrer">methods</a>. Your browser send an HTTP request to the server with one of them in front of the request so you cannot sent two method at the same time (an example of the request header from a web sniffer):</p> <pre><code>GET / HTTP/1.1[CRLF] Host: web-sniffer.net[CRLF] Connection: close[CRLF] User-Agent: Web-sniffer/1.0.31 (+http://web-sniffer.net/)[CRLF] Accept-Encoding: gzip[CRLF] Accept-Charset: ISO-8859-1,UTF-8;q=0.7,*;q=0.7[CRLF] Cache-Control: no[CRLF] Accept-Language: de,en;q=0.7,en-us;q=0.3[CRLF] Referer: http://web-sniffer.net/[CRLF] </code></pre> <p>The big difference from <strong>GET</strong> and <strong>POST</strong> is that GET retrieve a response from an <strong>url</strong> and POST send also some content data to that url. When you submit your form, data is collected in a standard format defined by enctype attribute and sent, also this time, to an url.</p> <p>Also the url is formatted in a standard manner and the portion of string found behind the <em>?</em> character is called <strong>QUERY STRING</strong>.</p> <p>When the server receives data, it communicates these informations to PHP which reads the URL and reads the method, the body (data) of the request and a huge amount of other things. Finally it <strong>fills</strong> its superglobal arrays with this data to let you know what the user sends (<a href="http://www.php.net/manual/en/reserved.variables.server.php" rel="nofollow noreferrer">$_SERVER</a>, <a href="http://www.php.net/manual/en/reserved.variables.get.php" rel="nofollow noreferrer">$_GET</a> and <a href="http://www.php.net/manual/en/reserved.variables.post.php" rel="nofollow noreferrer">$_POST</a> and a bunch of others);</p> <p>Important Notice! Also if PHP fill the $_GET superglobal with the query string of the URL and eventually the $_POST superglobal with the data found in the request body, <strong>$_POST and $_GET are not related to HTTP</strong>.</p> <p>So, if you want fill <strong>$_POST</strong> and <strong>$_GET</strong> in the same time you must send your form in this manner:</p> <pre><code>&lt;form method="post" action="http://myurl/index.php?mygetvar=1&amp;mygetvar=2"&gt; &lt;input name="year" type="text" /&gt; &lt;imput type="submit" /&gt; &lt;/form&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload