beginner101 Posted December 22, 2012 Share Posted December 22, 2012 (edited) I am working on a website with my project mates, in which I need to add a filter dropdown box. When I select one of the option in it, the table being displayed in that webpage will display a different set of data based on the type of data I selected to filter. Also this webpage can only be seen by logging in as a valid user. I am very new to javascript and php programming and after going through several forums, I added the following code as a start to do the filtering, by which the webpage will be able to get the dropdown box option that was selected and display it: <script> function formSubmit() { document.getElementById("report_filter").submit(); } </script> <form method="POST" id="report_filter" action="" > <select name="try" onchange="formSubmit();"> <option value="all">All</option> <option value="Windows">Windows</option> <option value="Win 2008">Win 2008</option> <option value="Win 7">Win 7</option> <option value="Win Vista">Win Vista</option> <option value ="Linux">Linux</option> <option value = "Win 7/Linux">Win 7/Linux</option> </select> </form> <?php if(!(isset($_POST["try"]))) { echo "none"; } else echo $_POST["try"]; ?> The code above works ok when i run that individually in a separate php page, i.e., it ehoes the option that i select in the drop down box. But not so when I add it to the webpage that I am working on, cause when I select an option in the dropdown box the page goes blank and nothing else happens. Edited December 24, 2012 by Zane Quote Link to comment https://forums.phpfreaks.com/topic/272273-submit-a-form-with-select-menu-dropbox-without-submit-button/ Share on other sites More sharing options...
trq Posted December 22, 2012 Share Posted December 22, 2012 Turn error reporting on for a hint. Quote Link to comment https://forums.phpfreaks.com/topic/272273-submit-a-form-with-select-menu-dropbox-without-submit-button/#findComment-1400849 Share on other sites More sharing options...
trq Posted December 22, 2012 Share Posted December 22, 2012 Turn error reporting on for a hint. Quote Link to comment https://forums.phpfreaks.com/topic/272273-submit-a-form-with-select-menu-dropbox-without-submit-button/#findComment-1400850 Share on other sites More sharing options...
trq Posted December 22, 2012 Share Posted December 22, 2012 Turn error reporting on for a hint. Quote Link to comment https://forums.phpfreaks.com/topic/272273-submit-a-form-with-select-menu-dropbox-without-submit-button/#findComment-1400851 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.