GET && POST

If you looked closely at the removescore.php in #3

you can find that we used both GET && POST in the same script.

whats the differences between the GET and POST ? 

when you want the script do the communication with each other, you might come to the idea

of using GET.

Data passed to a scirpt through a URL is available in the $_GET superglobal, which is an array very

similar to $_POST. Packaging data into a linked URL is the same as using GET request

in a web form.

In traditional HTML GET request, form data is automatically sent along to the form processing 

script as part of the script's URL. So we can do the same thing if we manually building our own

GET request as a custom URL.

There are some differences about the GET && POST :

1. POST requests can only be initiated through a form, while GET requests can be packaged as URLs.

2. The difference between GET and POST isn’t just form vs. URL since GET requests can (and often are)

used to submit form data as well. The real distinction between GET and POST has to do

with the intent of a request. GET is used primarily to retrieve data from the server

without affecting anything on the server. POST, on the other hand, typically involves sending data

to the server, after which the state of the server usually changes somehow in response to the data

that was sent.

So, generally speaking, GET is generally used for getting data from the server, not changing anything

on the server. So GET is perfect for forms that make information requests on the server without 

altering the state of the server, such as selecting rows from a database .

POST, on the other hand, is best suited for requests that affects the server's state, such as issuing an

INSERT or DELETE query that changes the database.

3. Another distinction between GET and POST is that data passed through a GET is visible in a URL,

while POST data is hidden, and, threrefore, POST is a bit more secure.

原文地址:https://www.cnblogs.com/beyond-Acm/p/4791587.html