How to pass multiple dynamic url parameters to my pagination pages when a user searches the site using PHP & MySQL
I was wondering how can I pass multiple dynamic url parameters to my pagination pages when a user searches the site using PHP & MySQL in 开发者_JS百科order to display their results?
Here is the HTML form.
<form action="search.php" method="post">
<input type="text" name="search" />
<input type="submit" name="submit" value="Search" />
</form>
Here is my pagination link
echo '<a href="search.php?s=' . ($start + $display) . '&p=' . $pages . '">'. $i .'</a>';
You can add those as hidden input types, or append them to the URL
<form action="search.php" method="post">
<input type="text" name="search" />
<input type="submit" name="submit" value="Search" />
<input type="hidden" name="s" value="<?php echo ($start + $display); ?>" />
<input type="hidden" name="p" value="<?php echo $pages; ?>" />
</form>
However that form is currently being posted and URLs are typically accessed with GET if that is the case you can do the following:
<form action="search.php?s=<?php echo ($start + $display) ?>&p=<?php echo $pages; ?>" method="post">
<input type="text" name="search" />
<input type="submit" name="submit" value="Search" />
</form>
Though you really should be more clear with your question.
精彩评论