l3asturd Posted August 20, 2007 Share Posted August 20, 2007 <?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 https://forums.phpfreaks.com/topic/65832-solved-sorting-refresh/ Share on other sites More sharing options...
MadTechie Posted August 20, 2007 Share Posted August 20, 2007 If using SQL then have a hyperlink like lists.php?sort=name&order=asc then just use those in your SQL statement.. make sense ? Link to comment https://forums.phpfreaks.com/topic/65832-solved-sorting-refresh/#findComment-328943 Share on other sites More sharing options...
l3asturd Posted August 20, 2007 Author Share Posted August 20, 2007 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 https://forums.phpfreaks.com/topic/65832-solved-sorting-refresh/#findComment-328959 Share on other sites More sharing options...
l3asturd Posted August 20, 2007 Author Share Posted August 20, 2007 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 https://forums.phpfreaks.com/topic/65832-solved-sorting-refresh/#findComment-328986 Share on other sites More sharing options...
trq Posted August 20, 2007 Share Posted August 20, 2007 It sets $_GET['sortby'] to 'name'. Link to comment https://forums.phpfreaks.com/topic/65832-solved-sorting-refresh/#findComment-328995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.