$_GET in PHP. Code example open

$_GET in PHP. Code example

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
Tested: PHP 5.6 +

When we type in the address of the script and press Enter, a GET request is made via the HTTP protocol. In this type of request, we can attach additional parameters to the main address. In order to transmit them, a question mark is placed at the end of the main address, and we can enumerate these parameters – like this:
parameter1=value1.

Form example

<html>
<head>
    <meta charset="UTF-8">
    <title>Example</title>
</head>
<body>
    <form action="process.php" method="GET">
        <label for="name">Name:</label>
        <input type="text" id="name" name="name"><br><br>
        <label for="email">Email:</label>
        <input type="email" id="email" name="email"><br><br>
        <input type="submit" value="Send">
    </form>
</body>
</html>

All parameters passed by the link are contained in the $_GET variable.

We can access these elements as if they were elements of a normal array.

echo $_GET['email'];
!The GET method creates a long string that displays in the server logs and in the address bar of the browser.
!The GET method is designed to send only up to 1024 characters.
!Never use the GET method if you need to send a password or other sensitive information to the server
!GET cannot be used to send binary data such as images or text documents to the server.
!Data sent via the GET method can be accessed using the QUERY_STRING environment variable.
$_POST in PHP. Code example open
$_POST in PHP. Code example
May 4, 2022
Roman-tk
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation