Hi All,
I want to make a very simple 'search tool' that works by matching words from a form's input box to a specific page (i.e. if you enter 'Contact' the form would redirect you to contact.html).
index.html
<form method='post' action='forwarder.php'>
<input id="myInput" type="text">
<input type='submit'>
</form>
forwarder.phpThis doesn't work, but you get the idea...
<?php
switch($myInput) {
default:
include('no_match.html');
break; case "about":
include('about.html');
break; case "contact":
include('contact.html');
break; case "page1":
include('page1.html');
break; case "page2":
include('page2.html');
break; case "page3":
include('page3.html');
}
?>
Please can you help me with forwarder.php?
Thank you,
Paul
PHP Form Page Switcher
Moderator: General Moderators
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: PHP Form Page Switcher
You are posting data from the form so the data is in the $_POST array:
Code: Select all
switch($_POST['myInput']) { mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.