In the PHP script that receives the form submission, check the submitted field and redirect matching values with header('Location: introduction.html'), followed immediately by exit. For example, the terms intro and introduction can both route to the same page.
Send the form to the PHP handler
The browser submits a form to the endpoint named by its action attribute. Set the method and field name deliberately so the receiving PHP script reads the value the form actually sends:
<form action="handler.php" method="post">
<label for="page">Page</label>
<input id="page" name="page" type="text">
<button type="submit">Go</button>
</form>
With method="post", the field named page is available as $_POST['page']. Keep those names and the method consistent; do not read a submit button’s name when the value to route is in a different input.
Check the value and redirect
Put the routing logic at the top of handler.php, before it prints a page or any other output:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
<?php
$page = $_POST['page'] ?? '';
if ($page === 'intro' || $page === 'introduction') {
header('Location: introduction.html');
exit;
}
// Continue normal form processing here.
?>
The strict comparisons match the two exact lowercase strings. If your form should accept different capitalization or surrounding spaces, normalize or validate the input intentionally rather than assuming it will be equivalent.
Why header() needs to come before output
PHP must send headers before actual output. Keep the redirect decision ahead of HTML, echoed text, and stray whitespace; otherwise the response headers may already have been sent and the redirect can fail. The PHP header() manual explains this requirement.
Rank #2
A Location header ordinarily produces a 302 response unless a 201 or 3xx status has already been set. Calling exit after header() stops the handler from continuing into code for the non-redirect path.
Keep destinations under your control
For a single permitted destination, a fixed string such as introduction.html is straightforward. If several choices are needed, map recognized input values to a predefined set of destinations and redirect only to a selected entry. Do not use arbitrary submitted text as a redirect URL.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Common mistakes to check
- The handler sees no value: Confirm that the form’s
actionpoints to the PHP script, its method ispost, and the input’snamematches the key read from$_POST. - The redirect does not happen: Check that no output or whitespace is sent before
header(). - Other handler code still runs: Put
exitimmediately after the redirect header. - Only one spelling matches: The example recognizes exactly
introandintroduction; add any other accepted forms as explicit cases.
Context for the original SitePoint question
The SitePoint Forums discussion from December 27–30, 2011 asked how to send typed values such as “intro” or “introduction” to introduction.html. Its useful control-flow point is to make the decision in the PHP handler receiving the form. The thread’s example snippets vary in field names and omit a clear, consistent form configuration, so use the aligned form-and-handler example above rather than copying a snippet verbatim.
Quick Recap
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

