MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

PHP 7 Fundamental Tutorial for Beginners – PHP GET and POST

Methods of Sending Information to Server

Diagram of browser sending data to the server with HTTP GET and POST methods

A web browser communicates with the server typically using one of the two HTTP (Hypertext Transfer Protocol) methods — GET and POST. Both methods pass the information differently and have different advantages and disadvantages, as described below.

The GET Method

In GET method the data is sent as URL parameters that are usually strings of name and value pairs separated by ampersands (&). In general, a URL with GET data will look like this:

http://www.example.com/action.php?name=john&age=24

The bold parts in the URL are the GET parameters and the italic parts are the value of those parameters. More than one parameter=value can be embedded in the URL by concatenating with ampersands (&). One can only send simple text data via GET method.

Advantages and Disadvantages of Using the GET Method

  • Since the data sent by the GET method are displayed in the URL, it is possible to bookmark the page with specific query string values.
  • The GET method is not suitable for passing sensitive information such as the username and password, because these are fully visible in the URL query string as well as potentially stored in the client browser’s memory as a visited page.
  • Because the GET method assigns data to a server environment variable, the length of the URL is limited. So, there is a limitation for the total data to be sent.

PHP provides the superglobal variable $_GET to access all the information sent either through the URL or submitted through an HTML form using the method=”get”.

Example:

The POST Method

In POST method the data is sent to the server as a package in a separate communication with the processing script. Data sent through POST method will not visible in the URL.

Advantages and Disadvantages of Using the POST Method

  • It is more secure than GET because user-entered information is never visible in the URL query string or in the server logs.
  • There is a much larger limit on the amount of data that can be passed and one can send text data as well as binary data (uploading a file) using POST.
  • Since the data sent by the POST method is not visible in the URL, so it is not possible to bookmark the page with specific query.

Like $_GET, PHP provide another superglobal variable $_POST to access all the information sent via post method or submitted through an HTML form using the method="post".

Example:

The $_REQUEST Variable

PHP provides another superglobal variable $_REQUEST that contains the values of both the $_GET and $_POST variables as well as the values of the $_COOKIE superglobal variable.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

List of Top Free Open Source & Self Hosted Application for Web Servers

This page lists the main free, open source, self-hosted web servers and HTTP proxies: Nginx, Apache HTTP Server, Caddy, Lighttpd, Hiawatha, Algernon, HAProxy, Traefik and Varnish. Below…

Read More

HTTP 404 for DevOps: Root-Cause, Routing, and Prevention Across Edge, Ingress, and App Layers

HTTP 404 errors are simple for users but often complex in distributed systems. This guide shows DevOps teams how to locate the failing layer, apply the right fix, and prevent repeat incidents.

Read More

Jenkins Command-Line Authentication and Job Triggers with cURL and Wget

Learn practical ways to authenticate scripted requests to Jenkins and trigger jobs from the command line using cURL and wget. This revision also covers CSRF crumb handling, version caveats, and troubleshooting.

Read More

Common Gateway Interface (CGI): How It Works, Server Requirements, and Basic Setup

CGI is the classic interface that lets a web server execute server-side programs in response to HTTP requests. This revised guide covers CGI fundamentals, server prerequisites, setup checks, and a minimal working example.

Read More

Apache and HTTP Interview Questions: Updated Answers for DevOps Engineers

A modernized Apache and HTTP interview guide with practical, production-focused answers. Includes command comparisons, config examples, and a safe change workflow.

Read More

Building Resilient Web Data Pipelines: How to Handle Rate Limits, Proxy Failures and Infrastructure Outages

A web data collection script can work perfectly during testing and still become unreliable within hours of entering production. A target website may start returning rate limits….

Read More