janim Posted October 30, 2007 Share Posted October 30, 2007 hi every body i wanna use simple filter like this : <form action="" method="post" > <select name="select2"> <option value="new">new</option> <option value="old">old</option> </select> </form> <? $filter="id desc"; $filter="id asc"; $filter="anything else"; $showing=mysql_db_query($bas,"select * from $movtab order by $filter ) or die ?> as you see i can't detect what is will change the $filter variable so any suggestion please Quote Link to comment https://forums.phpfreaks.com/topic/75320-solved-how-to-use-form-for-filtering/ Share on other sites More sharing options...
~n[EO]n~ Posted October 30, 2007 Share Posted October 30, 2007 What are you trying to do ? Quote Link to comment https://forums.phpfreaks.com/topic/75320-solved-how-to-use-form-for-filtering/#findComment-380952 Share on other sites More sharing options...
kyleabaker Posted October 30, 2007 Share Posted October 30, 2007 If you want the content that you're filtering to change as you pick new or old then you will need either ajax to change it in a container on the page or just reload the page with the settings that are selected. However, I also would need more details as to what you are trying to do..? If you are planning to reload the page when the form is submitted then you could use $HTTP_POST_VARS or $_GET to grab the settings you select and sort the content. You could also set the default selected item in the select box by echoing the options out and adding (I think this is correct) "selected" inside the <option> tag. Quote Link to comment https://forums.phpfreaks.com/topic/75320-solved-how-to-use-form-for-filtering/#findComment-380992 Share on other sites More sharing options...
janim Posted October 30, 2007 Author Share Posted October 30, 2007 yea thank you kyleabaker that's right i have done it with <form method="get" action ""> it's with that simple so if you interested in code i will post it Quote Link to comment https://forums.phpfreaks.com/topic/75320-solved-how-to-use-form-for-filtering/#findComment-381118 Share on other sites More sharing options...
kyleabaker Posted October 30, 2007 Share Posted October 30, 2007 Go a head and post some of your code and I'll see if I can help more. Quote Link to comment https://forums.phpfreaks.com/topic/75320-solved-how-to-use-form-for-filtering/#findComment-381546 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.