tags:

views:

25

answers:

1

How can you pass multiple search parameters a user enters through the query string when generating pagination links using PHP & MySQL?

Here is the HTML form.

<form action="search.php" method="post">
    <input type="text" name="search" />
    <input type="submit" name="submit" value="Search" />
</form>
+1  A: 

Just do a http_build_query() on the complete set of variables, including the pagination and use that?

Edit: The code sample from my comment:

$aNextPage = array('text' => $_REQUEST['text'], 'page' => $_REQUEST['page']+1);
echo '<a href="' . http_build_query($aNextPage) . '">Next page</a>';
Blizz
huuuuuuuhhhhhhhh?
lone
$aNextPage = array('text' => $_REQUEST['text'], 'page' => $_REQUEST['page']+1);echo '<a href="' . http_build_query($aNextPage) . '">Next page</a>'; Perhaps this makes things clearer? (You might want to do some validation on the input though :) )
Blizz