PHP

header() & redirects

Në shqip: Ridrejtimet në PHP

ShpjegimiSQ

header("Location: /faleminderit") e dërgon përdoruesin në një faqe tjetër — zakonisht pas dërgimit të një formulari. Kujdes: header() duhet thirrur para se të nxirret çdo HTML, përndryshe del gabimi „headers already sent“.

EnglishEN

header("Location: /thank-you") sends the user to another page — usually after a form is submitted. Careful: header() must be called before any HTML is output, or you get the “headers already sent” error.

Si ta mendosh

Si të ndryshosh adresën në zarf para se ta dërgosh — pasi e ke postuar, është vonë.

Lexoje në anglisht

Like changing the address on an envelope before posting it — once it's sent, it's too late.

Shembull kodiphp

<?php
// ruaj formularin...
header("Location: /faleminderit");
exit;

Terma të lidhur