Form Handling
An HTML form POSTs to a PHP file. <form method='post' action='save.php'> then in save.php: $name = $_POST['name'] ?? ''; Never trust it — trim, check empty, htmlspecialchars when you print back.
GET puts data in the URL (?name=Asha) — $_GET. Use POST for passwords and saves. After a successful POST, redirect (PRG) so refresh doesn’t save twice.
Trap — putting $_POST straight into SQL. Use prepared statements. Trap: printing $_POST into HTML without escape (XSS).
Browser
│ POST / GET
▼
.php file
│
▼
HTML backExam tip
$_POST['name'] after a form. Validate + htmlspecialchars.