|
Posted by Peter van Schie on 11/03/05 10:41
Big Time wrote:
> I have a search form used to query a MySQL database. I want the search
> results to appear on the same page as the search form, below the search box
> after the have entered their search criteria. I can do this using the GET
> method, however this displayrs all the parameters in the URL. I understand
> you can hide the parameters by using the POST method, however what I'm not
> understanding is how I can display the results on the same page. If I use
> the POST method, it takes the user to a new page which I don't want.
Hi Big Time,
Why would it take the user to a new page? It can take the user to the
same page as well:
<form name="search" action="<?php echo $_SERVER['PHP_SELF'];" method="POST">
Search for: <input type="text" name="keyword">
<br />
<input type="submit" value="Search">
</form>
Then at the top of your searchscript, say something like:
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
// insert your search code here, using the data in $_POST
}
HTH.
Peter.
--
http://www.phpforums.nl
Navigation:
[Reply to this message]
|