The web browser communicates with the web server by using two HTTP methods GET and POST. These methods are used to send information to the web server. Here we will learn about these methods and the difference between these two methods.
Page Contents
GET method:
When we use the GET method it sends data to the web server as URL parameters. It sends data to a web server in the key-value pair. When you work with the GET method you can easily see all GET parameters in the URL bar like this http://www.example.com/search.php?product=books. Here we will learn how we can send data from an HTML form to a server using the GET method.
Example Program:
<?php
if(isset($_GET["Submit"])){
echo "<p-->Hello, " . $_GET["name"] . "<p></p>";
}
?>
<form method="GET">
<input type="text" name="name">
<input="" value="Submit">
</form>
POST method:
When we send data using the POST method to the webserver. Data would not visible in the URL bar. In the POST method data send to the web server separately as a package with a processing script. Check this example to understand it.
Example Program:
<?php
if(isset($_POST["Submit"])){
echo "<p-->Hello, " . $_POST["name"] . "<p></p>";
}
?>
<form method="POST">
<input type="text" name="name">
<input="" value="Submit">
</form>
Parvesh Sandila is a results-driven tech professional with 8+ years of experience in web and mobile development, leadership, and emerging technologies.
After completing his Master’s in Computer Applications (MCA), he began his journey as a programming mentor, guiding 100+ students and helping them build strong foundations in coding. In 2019, he founded Owlbuddy.com, a platform dedicated to providing free, high-quality programming tutorials for aspiring developers.
He then transitioned into a full-time programmer, where his hands-on expertise and problem-solving skills led him to grow into a Team Lead and Technical Project Manager, successfully delivering scalable web and mobile solutions. Today, he works with advanced technologies such as AI systems, RAG architectures, and modern digital solutions, while also collaborating through a strategic partnership with Technobae (UK) to build next-generation products.
