View Full Version : Search Form Question...
07-19-2007, 03:44 PM
I have a search form set up... First page is the search fields second page is the results... I really want the whole thing to be together so I thought the best way was just do a php include on the second page for the search page. The only thing is now each time the page loads it runs the search with no fields, so basically outputs everything in the database... Anyone have a better idea of how to do this?
07-19-2007, 04:16 PM
<form action="" method="POST">
<input type="text" name="search_term">
<input type="submit" name="submit" value="search">
// do search and display results
07-19-2007, 04:24 PM
well it would help if you could post your code, but I'm pretty sure I understand the problem. A switch statement to see whether the form button has been pressed will do it.
<form action=<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
Search <input type="text" name="search" />
<input type="submit" value="Search" name="button" />
The form above can be a separate file and included in the default case or can be echoed in the default case.
} //end switch
07-20-2007, 02:12 AM
Hi guys... I added the above code
at the top of the search.php page, then on the results page I have my include but when you run the results page it srtill gives me all the results... any ideas?
07-20-2007, 04:33 PM
Post your code...
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.