chrisuk Posted February 25, 2007 Share Posted February 25, 2007 I am currently in the process of refining an IT helpdesk system and I am trying to implement filtering. At the minute, all calls for a user show up when they log in. What I would like is for them to select an option from a drop down menu, and then only records matching the criteria will be shown. I've coded this in PHP with the correct SQL statements, whereby it takes the value currently set in a list/menu and selects the certain records based on the if statements. My question is......how do i get the page to remember that the option has been changed and only display the corresponding records? I have a "go" button which submits the form to itself and reloads the page, but I can't quite figure out how to pass the value of the selected option back, as the default option just keeps reloading. however, if i echo the contents of the menu, it does show what i have selected...but does not show these records only.. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/ Share on other sites More sharing options...
chrisuk Posted February 26, 2007 Author Share Posted February 26, 2007 sorry to bump this but can anybody help? Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/#findComment-194302 Share on other sites More sharing options...
magnetica Posted February 26, 2007 Share Posted February 26, 2007 I have done this but only got it to work for IE and not FF But heres what I did: <select name="genres" onchange="location.href=genres.options[selectedIndex].value" style="width: 75px; font-size: 7pt;"> <option selected="selected">Genres..</option> <option value="page.php?query=value" >Action</option> <option value="page.php?query=value" >Arcade</option> <option value="page.php?query=value" >Platform</option> <option value="page.php?query=value" >Puzzle</option> <option value="games.php?g=Shooting" >Shooting</option> <option value="page.php?query=value" >Sports</option> <option value="page.php?query=value" >Assorted</option> </select> Obviously change accordingly Oh and this will redirect automatically. To get the value either use $_GET or $_POST Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/#findComment-194305 Share on other sites More sharing options...
Yesideez Posted February 26, 2007 Share Posted February 26, 2007 ChrisUK, are you using GET or POST method in your form or is everything on the URL? Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/#findComment-194321 Share on other sites More sharing options...
monk.e.boy Posted February 26, 2007 Share Posted February 26, 2007 ChrisUK, are you using GET or POST method in your form or is everything on the URL? Doesn't really matter if you use the $_REQUEST global super variable. I think what you want to do is: <php if( isset( $_REQUEST['selected'] ) ) { switch( $_REQUEST['selected'] ) { case 'Action' : include_once 'action.php'; } } ?> Something like this? Your code is a little confused See how I check the value of the variable, then include the correct php page. See how you could write out the header of the page (your site logo, menus and stuff) then include the correct page, e.g. games, then after you could write out the footer (bottom of page, copyright, date time etc) 1. display top of page 2. display menu 3. look at 'selected' and include that bit 4. finish page cheers monk.e.boy monk.e.boy Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/#findComment-194340 Share on other sites More sharing options...
chrisuk Posted February 26, 2007 Author Share Posted February 26, 2007 gents - a thousand.....actually no...a million thankyous. On reflection that's pretty simple but I just couldn't for the life of me get it to work! Working great now, exactly what i needed. Oh how I love the internet! Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/40040-solved-filtering-records-based-on-menu-option-selected/#findComment-194547 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.