Keeping Drop-Down value to the next page
Moderator: General Moderators
Keeping Drop-Down value to the next page
Okay, I have a page that displays entries obtained from a database, and I have it set to only allow 5 entries per page and you can click on each page number to see the other entries. Now I want to be able to sort my entries. I've already set up a form and my database is setup to order the entries by whatever I tell it to. The problem is that, for example you are looking at page #1 and you click to sort by price, it works fine, but when you click on page #2 it reverts back to the original order. Does anyone know where I can find the code to do this? I hope I haven't confused anyone. If you want to see what I'm talking about you can go to www.GarrettMcKone.com and click on the properties.
Code: Select all
echo "<select name=\"someSelect\">";
while($row = mysql_fetch_assoc($result))
{
echo "<option value=\"".$row['someCol']."\" ".(isset($_POST['someSelect']) && $_POST['someSelect'] == $row['someCol'] ? "selected=\"selected\"" : "").">".$row['someCol']."</option>";
}
echo "</select>";Maybe I don't understand how to use your code, but my problem is not displaying the right options, or even selecting the right options. Every time that the page refreshes without the user clicking the submit button, ie when they click to go to the next page of entries, the form resets, causing the sorting to go back to the way it was before they used the form. Is there a way to carry their choice from page to page?