views:

17

answers:

1

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 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>';
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.

Marco Ceppi
I want to know how to pass multiple dynamic url parameters which are the search terms the user entered into the search box.
lone
PHPology
@lone what do you mean by "in the search box" the actual TEXT search box or something else?
Marco Ceppi