Difference Between $_GET and $_POST in PHP

This article explains the primary differences between the $_GET and $_POST superglobal variables in PHP. It covers how they transmit data, their security implications, storage limits, and the specific scenarios where you should use one over the other.

The Core Difference

The fundamental difference between $_GET and $_POST lies in how they send data to the server.


Detailed Comparison

To choose the right method for your PHP application, you must understand how they differ across several key areas:

1. Security

2. Data Limits

3. Bookmarking and Caching


Quick Reference Summary

Feature $_GET $_POST
Data Location URL Query String HTTP Request Body
Visibility Public (visible in URL) Hidden from URL
Max Capacity ~2,048 characters No limit (configurable)
Security Low (unsuitable for sensitive data) Medium (suitable for sensitive data with HTTPS)
Can be Bookmarked? Yes No
Can be Cached? Yes No

When to Use Which?

Use $_GET when:

Use $_POST when: