Thundarfoot Posted January 15, 2008 Share Posted January 15, 2008 I am displaying the contents of a mysql table, in a html format table. I would like to make the columns sortable by the user. I would like a drop box type selection in place of the current column name. I realize this may be beyond the scope of a simple post exchange, however any advice or help is mucho appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/ Share on other sites More sharing options...
priti Posted January 15, 2008 Share Posted January 15, 2008 Hi, In column header you want to have dropdown ??? consider: Name Age ads 12 dzd 22 now in column on eyou would be having a drop down with Name and Age?? i would say this is not the better view with design rather you can creae column headers as clickable links which sort the data on click. Regards Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/#findComment-439631 Share on other sites More sharing options...
Thundarfoot Posted January 15, 2008 Author Share Posted January 15, 2008 Using your example, I would like to be able to click on Age and be able to choose from option to show 1. 0-9 2. 10-20 3. 21-100 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/#findComment-439637 Share on other sites More sharing options...
priti Posted January 15, 2008 Share Posted January 15, 2008 Using your example, I would like to be able to click on Age and be able to choose from option to show 1. 0-9 2. 10-20 3. 21-100 Thanks Thats what i query you for? that waa suggestion that if you want to simply sort data in table according to your header name.You didn't put up that you want parameters also attached with search results. Well with this case you need to go your way but still putting drop down in place of column header is not suggestable either you can make bit more flexible that when you click you column header user will be able to see the drop down box with your search parameter.so he knows what he is searching and the parameter he is trying. Regards Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/#findComment-439643 Share on other sites More sharing options...
ratcateme Posted January 15, 2008 Share Posted January 15, 2008 Try something like this <form id="form1" name="form1" method="get" action=""> <select name="select"> <option value="0-9">0-9</option> <option value="10-20">10-20</option> <option value="21-100">21-100</option> </select> <input type="submit" value="Show" /> </form> <?php $age=$_GET['age'] $age=explode('-',$age); $query='SELECT * FROM `people` WHERE `age` > \''.$age[0].'\' AND `age` < \''.$age[1].'\';'; $result=mysql_query($query); //do something ?> Scott. Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/#findComment-439644 Share on other sites More sharing options...
adam291086 Posted January 15, 2008 Share Posted January 15, 2008 if you are wanting this to happen automatically. I.e select the age and the result to display without having to click on submit you need to look into Ajax. Quote Link to comment https://forums.phpfreaks.com/topic/86099-want-to-make-table-sortable/#findComment-439645 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.