Hi all,
I've got a search form on my website that provides a way for users to search both the PHP manual and the MySQL manual directly from my website. The form looks like this:
<form method="post" action="http://domain.com/search/manual_search.php" target="_blank">
<table class="menu_search" width="100%" align="center" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="search_query"><input type="text" name="query" size="18"></td>
<td class="search_submit"><input class="submit" type="submit" name="search" value="Search"></td>
</tr>
<tr>
<td class="search_area">
<select name="manual">
<option value="php_manual">PHP Manual</option>
<option vlaue="mysql_manual">MySQL Manual</option>
</select>
</td>
</tr>
</table>
</form>
And, to process this form:
<?php
if ($search) {
if (!$query) {
echo "<p><strong>Error:</strong><br>You have not typed anything to search for.<br>Please <a href=\"http://domain.com/\">return to the PHP Webmaster homepage</a> and search again.</p>";
exit;
}
else {
if ($manual == "php_manual") {
$query = $_POST["query"];
$pattern = $query;
$show = "quickref";
$lang = "en";
header("Location: [url]http://www.php.net/search.php?pattern=[/url]$pattern&show=$show&lang=$lang");
exit;
}
elseif ($manual == "mysql_manual") {
$query = $_POST["query"];
$q = $query;
header("Location: [url]http://www.mysql.com/doc/search.php?q=[/url]$q");
exit;
}
else {
header("Location: [url]http://domain.com/[/url]");
exit;
}
}
}
else {
header("Location: [url]http://domain.com/[/url]");
exit;
}
?>
Now, when I submit the form with PHP Manual option selected on the SELECT form element, everything works fine. However, when selecting the MySQL manual option, it just redirects to http://domain.com/ which skips the elseif ($manual == "mysql_manual") { section.
Any ideas anyone???