Hi I currently have a page with a search box with several check-boxes that allow people to specify their search. It works perfectly however it is all on one page. I want to have the search box on another page and when the user presses search it display the results on another page. How do I go about doing this?
I’ve tried changing the form action to the new page however it does not display any results.
The is the current code:
(top of the page)
[php]
" . mysql_error() . "
SQL Was: {$searchSQL}"); if (mysql_num_rows($searchResult) < 1) { $error[] = "The search term provided {$searchTerms} yielded no results."; }else { $results = array(); // the result array $i = 1; while ($row = mysql_fetch_assoc($searchResult)) { $results[] = " ID: {$row['ID']}
Name: {$row['FirstName']}{$row['LastName']}
Email Address: {$row['Email']}
Phone Number: {$row['PhoneNumber']}
Mobile Number: {$row['MobileNumber']}
Department: {$row['Department']}
Location:{$row['Location']}
Hours Worked: {$row['HoursWorked']}
"; $i++; } } } } function removeEmpty($var) { return (!empty($var)); } ?>
[/php]
The form
[php]
" . implode("
", $error) . "
":""; ?>
<form method="GET" action="<?php echo $_SERVER['PHP_SELF'];?>" name="searchForm">
Search For: <input type="text" name="search" value="<?php echo isset($searchTerms)?htmlspecialchars($searchTerms):''; ?>" />
<br />
Search In:<br />
First Name: <input type="checkbox" name="FirstName" value="on" <?php echo isset($_GET['FirstName'])?"checked":''; ?> />
Last Name: <input type="checkbox" name="LastName" value="on" <?php echo isset($_GET['LastName'])?"checked":''; ?> />
Email: <input type="checkbox" name="Email" value="on" <?php echo isset($_GET['Email'])?"checked":''; ?> />
ID: <input type="checkbox" name="ID" value="on" <?php echo isset($_GET['ID'])?"checked":''; ?> />
Location: <input type="checkbox" name="Location" value="on" <?php echo isset($_GET['ID'])?"checked":''; ?> />
<br />
<br />
<input type="submit" name="submit" value="Search!" />
</form>
<?php echo (count($results) > 0)?"Your search term: {$searchTerms} returned:<br /><br />" . implode("", $results):""; ?>
[/php]