Jump to content

[SOLVED] Sorting refresh


l3asturd

Recommended Posts

<?php
$content .=" Sort by : <SELECT name=\"sortby\" size=\"1\" STYLE=background:#FFCC00;>";
$content .="<OPTION SELECTED>Site<OPTION>Service Tag<OPTION>User<OPTION>Computer Name";
$content .="<OPTION>Model<OPTION>Condition<OPTION>Status<OPTION>Newest<OPTION>Oldest</SELECT>";
?>

 

I know this is probably more of an HTML question, or a FORM question, but I've been trying to figure out how to make the "sortby" dropdown selection auto submit. So when someone clicks Sortby:Computer Name the page auto refreshes with the new ORDER by variable. Any help is appreciated. Thanks.

 

Link to comment
Share on other sites

If using SQL then have a hyperlink like

lists.php?sort=name&order=asc

 

then just use those in your SQL statement.. make sense ?

 

I may understand. Let's say my form action (only for the sorting dropdown) is going to be link:http://www.domain.com/list.php?sortby=Computer

 

Is this what you mean?

 

No, that's not what you mean. Let me read a few more times.

Link to comment
Share on other sites

ok, well, what does this actually do?

 

list.php?sortby=name

 

does this set a $sortby variable to "name"? Or does it act like a $_POST['sortby'] variable. Hopefully it does the first thing, because I think I can work with that.

If it sets $sortby, I would just include $sortby in my SQL query right?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.