_user
04-26-2012, 06:10 PM
I have a form
<select>
<option value="">Select color</option>
<option value="black">black</option>
<option value="red">red</option>
</select>
<select>
<option value="">Select size</option>
<option value="one">two</option>
<option value="two">two</option>
</select>
<input type="submit" value="Submit" name="submit" />
$color = $_GET['color'];
$size = $_GET['size'];
(...)
$query = "SELECT * FROM table WHERE color LIKE '%$color%' AND size LIKE '%$size%' LIMIT $start, $per_page ";
(...)
and the search link is something like this:
www.domain.com/file.php?color=black&size=two&submit=Submit
When paginating the results, when I click to page2 I get page2 with all the results from db (not the color and size selected on the search) and the link is something like this www.domain.com/file.php?page=2
How can I resolv this problem?
I searched and read about this problem for a while... but I can't find the solution.
Now I think to do a verification to run the query just when I click the submit button.
Something like this
<input type="hidden" name="searching" value="yes" />
and
if ($searching =="yes")
.
Any other ideea?
<select>
<option value="">Select color</option>
<option value="black">black</option>
<option value="red">red</option>
</select>
<select>
<option value="">Select size</option>
<option value="one">two</option>
<option value="two">two</option>
</select>
<input type="submit" value="Submit" name="submit" />
$color = $_GET['color'];
$size = $_GET['size'];
(...)
$query = "SELECT * FROM table WHERE color LIKE '%$color%' AND size LIKE '%$size%' LIMIT $start, $per_page ";
(...)
and the search link is something like this:
www.domain.com/file.php?color=black&size=two&submit=Submit
When paginating the results, when I click to page2 I get page2 with all the results from db (not the color and size selected on the search) and the link is something like this www.domain.com/file.php?page=2
How can I resolv this problem?
I searched and read about this problem for a while... but I can't find the solution.
Now I think to do a verification to run the query just when I click the submit button.
Something like this
<input type="hidden" name="searching" value="yes" />
and
if ($searching =="yes")
.
Any other ideea?