🌐
GeeksforGeeks
geeksforgeeks.org › php › http-get-post-methods-php
HTTP GET and POST Methods in PHP - GeeksforGeeks
December 6, 2021 - In this article, we will know what HTTP GET and POST methods are in PHP, how to implement these HTTP methods & their usage, by understanding them through the examples. HTTP: The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers.
🌐
Tutorialspoint
tutorialspoint.com › php › php_get_post.htm
PHP - GET & POST
The PHP provides $_GET associative array to access all the sent information using GET method.
🌐
Studyopedia
studyopedia.com › home › php get method
PHP GET Method - Studyopedia
May 4, 2023 - For sending information to the web server, use PHP GET method. Information sent via the GET method isn’t hidden and can be seen in the URL.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › php tutorial › php get method
PHP GET Method | How PHP GET Method Works? (Examples)
April 10, 2023 - The Get Method of the PHP Programming Language is very helpful in requesting the data from the specified/specific resource. It is one of the HTTP request methods of requesting the data from the particular resource. HTTP usually works just like ...
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
PHP
php.net › manual › en › reserved.variables.get.php
PHP: $_GET - Manual
There is no need to do global $variable; to access it within functions or methods. ... The values in $_GET are automatically passed through urldecode().
🌐
Stack Overflow
stackoverflow.com › questions › 55879606 › what-is-the-difference-between-method-get-and-get
php - What is the difference between method="get" and $_GET? - Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most. Learn more about Collectives ... The question is pretty self explanatory - to my understanding method="get" is the HTML functionality of PHP's $_GET.
🌐
W3Schools
w3schools.com › php › php_superglobals_get.asp
PHP $_GET Superglobal
The $_GET superglobal contains an array of variables received via the HTTP GET method.
🌐
Simplilearn
simplilearn.com › home › resources › software development › php tutorial › the best way to understand php get method with an example
The Best Way To Understand PHP GET Method With An Example | Simplilearn
August 13, 2024 - Learn how to submit data from HTML FORM using PHP GET method. This method sends the encoded information from the FORM through the webpage URL.
Address: 5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Scaler
scaler.com › home › topics › get and post methods in php
Get and Post Methods in PHP - Scaler Topics
April 12, 2024 - The GET method sends data as part of the URL query string, which is visible to the user. The data is sent in the form of name-value pairs separated by an equal sign (=), and multiple pairs are separated by an ampersand (&). The name and value are separated by a single equal sign, and the value ...
Find elsewhere
🌐
YouTube
youtube.com › watch
GET Method in PHP - Tutorial 6 - YouTube
This tutorial briefly discusses the GET method in PHP. This is similar to the POST method, but it allows the user to see the data in the URL. This is commonl...
Published: April 13, 2013
🌐
EDUCBA
educba.com › home › software development › software development tutorials › php tutorial › get and post methods in php
GET and POST Methods in PHP: Step by Step Methods
March 18, 2024 - The server-side script (getmethod.php) retrieves the name and email values using $_GET and generates a response accordingly. It will display the output as “Hello, Sammy! Your email is [email protected],” as shown in the above GIF. So, this is how the GET method works in PHP.
Address: Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
CodeWithHarry
codewithharry.com › tutorial › php-get
$_GET | PHP Tutorial | CodeWithHarry
The PHP $_GET is a PHP superglobal which is used to collect form data after submitting an HTML form using method="get". Information sent from an HTML form with the GET method is displayed in the browser's address bar, making it less secure than POST.
🌐
Biogem
biogem.org › downloads › notes › GET and POST method in PHP.pdf pdf
1 GET and POST method in PHP
Before the browser sends the information, it encodes it using a scheme called URL encoding. In this · scheme, name/value pairs are joined with equal signs and different pairs are separated by the ... The GET method sends the encoded user information appended to the page request.
🌐
GeeksforGeeks
geeksforgeeks.org › php › get-and-post-in-php
$_GET and $_POST in PHP - GeeksforGeeks
July 23, 2025 - In this article, we will explore what $_GET and $_POST are, how they work, and their use cases in PHP programming. The $_GET superglobal is used to collect form data sent via the GET method. This method appends data to the URL as query parameters, which are visible to users in the browser’s address bar.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-access-data-sent-through-url-with-get-method-in-php
How to access data sent through URL with GET method in PHP ? - GeeksforGeeks
July 23, 2025 - So input fields are used to make the website interactive and to collect data. But we know that HTML can not store the data in a database so for that we use a backend scripting language like PHP. URLs structure for GET method: In GET method, the URL contains all the data that is being sent from the front end.
Top answer
1 of 3
1

This is a pretty common type of thing for a PHP application to do. The general pattern is:

  1. Pull a list of items from a database and display them with links to interact with specific items.
  2. When a link is clicked, display a form with the information of the selected item.
  3. When the form is submitted, save the user input to the selected item.

The minimum you need to implement this pattern is the following:

Step 1 (display the items):

<?php
// using mysqli for example here, but the same general idea for pdo or any other
$result = mysqli_query('SELECT id, some_text, other_columns FROM your_table WHERE criteria');
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
    $id = htmlspecialchars($row['id']);
    $text = htmlspecialchars($row['some_text']);
    echo '<a href="url/to/your_form.php?id=' . $id . '">' . $text . '</a><br>';
}
?>

Clicking a link (<a>) sends an HTTP GET request to the URL in its href parameter.

Step 2 (display the form):

When PHP handles the request, anything you have included in the query string of the URL (the ?id=x portion) will be availabe in the $_GET array. There are two ways you can handle this piece of data so that it can be passed on to step 3. One way is to include it in the URL in the action parameter of your form:

<form action="url/to/submission_handler.php?id=<?php echo $_GET['id']; ?>" method="post">

Another way is to include a hidden form element that contains the ID.

<form action="url/to/submission_handler.php" method="post">
    <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">

Step 3 (handle the form submission):

In this step, if you have passed the ID via the action parameter, it will be available in the $_GET array ($_GET['id']), and if you have passed it via an input on the form, it will be available in the $_POST array. ($_POST['id']). Either way, you should be able to access it for use in your query.

<?php
$id = $_GET['id']; // or $_POST['id'], depending on which way you handled it on your form

// Using a prepared statement here for example rather than concatenating values into the 
// SQL string, in order to reduce risk of SQL injection

// (Assuming $mysli is a connected mysqli object)
$stmt = $mysqli->prepare('UPDATE your_table SET ... WHERE id=?');
$stmt->bind_param("i", $id);
$stmt->execute();
?>

Either method of passing the id from your form to the script that handles its submission is perfectly valid, functional and commonly used. As far as I know, which way you should do it is really just determined by your own personal preference. But you should note that passing parameters in the query string of the action paramater will only work for forms with method="post". If you ever need to use method="get" instead, only the values in the form fields will be available in $_GET; parameters in the query string will be ignored. (For forms that will make changes on your server, (INSERT, UPDATE, or DELETE queries, writing to files, etc.) you should always be using method="post" anyway, but just FYI.)

2 of 3
0

If you want to print a variable you need it

<input type = "hidden" name = "post_id" value = "<?php echo $_GET['post_id']; ?> ">

And you will see the value of post_id

🌐
W3Schools
w3schools.in › php › get-post
PHP GET and POST - W3schools
In PHP, the $_GET variable is used to collect values from HTML forms using method get.
🌐
Stack Overflow
stackoverflow.com › questions › 38231659 › php-get-method-what-for
html - Php get method - what for? - Stack Overflow
The GET method is useful in situations where the GET variable is used to display particular data from your website, such as maybe the results of a movie lookup or something, because the GET variable is part of the URL, thus it can be bookmarked.
🌐
Educative
educative.io › answers › php-get
PHP $_GET
August 28, 2020 - FINAL HOURS: Lock in 50% off for MANGOS sale!MANGOS sale: Get 50% off! ... PHP $_GET is an associative array of variables passed to the current script via the URL parameters.