Finals Lecture 1: PHP Flashcards
In PHP, GET and POST are two different methods used to…
send data from a form to a server.
Data is appended to the URL.
GET Method
Limited amount of data can be sent because it is included in the URL.
GET Method
Data is visible to everyone in the URL, including the user.
GET Method
Not suitable for sensitive data.
GET Method
Example of a form using the GET method in HTML:
In this example, if the user enters “john” into the text field and submits the form, the URL may look like this: process.php?username=john
<form>
<input></input>
<input></input>
</form>
In PHP, you can access the data sent via GET using the…
$_GET superglobal array;
For example:
$username = $_GET[‘username’];
Data is included in the body of the HTTP request.
POST Method
Can send larger amounts of data.
POST Method
Data is not visible in the URL.
POST Method
Suitable for sensitive data.
POST Method
Example of a form using the POST method in HTML:
<form>
<input></input>
<input></input>
</form>
In PHP, you can access the data sent via POST using the…
$_POST superglobal array;
For example:
$username = $_POST[‘username’];
In many cases, the choice between GET and POST depends on the…
nature of the data being transmitted.
Use GET when you are ___, and use POST when you are ___ or ___.
retrieving data from the server; sending sensitive information; making changes on the server