GET / POST ve PHP Forms

15–19 Şubat 2027

Ders Notu

GET

<form method="get" action="search.php">
    <input name="q">
</form>
$query = isset($_GET['q']) ? $_GET['q'] : '';

GET verisi query string'de görünür ve arama/filter için doğaldır.

Hedef görünüm

PHP Request Flow sayfasının hedef görünümü

Sol form GET ile arama, sağ form POST ile mesaj gönderme akışını başlatır.

HTML form
↓ method + action
HTTP request
↓ name=value
PHP $_GET / $_POST
↓
HTML response

POST

<form method="post" action="contact.php">
    <input name="email" type="email">
</form>
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $email = isset($_POST['email']) ? $_POST['email'] : '';
}

POST tek başına güvenlik sağlamaz. HTTPS ve server validation farklı konulardır.

Redirect

header('Location: thank-you.php');
exit;

Header'dan önce HTML/echo gönderme. Network'te POST, 302 ve sonraki GET'i incele.

Debug sırası: form method → action → name → Network data → doğru superglobal/key.