$_GET and $_POST are commonly used to receive form data. GET sends data through the URL query string, making it a good fit for search, filters, and shareable links. POST sends data in the request body, making it a better fit for logins, contact forms, and create/update actions.
php
<?php
// Example URL: search.php?keyword=php
$keyword = $_GET["keyword"] ?? "";
if ($keyword !== "") {
echo "You searched for: " . htmlspecialchars($keyword);
} else {
echo "Please type a search keyword.";
}
?>You should see
If the URL includes ?keyword=php, it will display You searched for: php.