kirtney Posted August 8, 2013 Share Posted August 8, 2013 Hello I am trying to create a web form that inserts user data. So how it works is that a user selects a department (departmentQ) from the drop down list and is routed to a second page that displays the people in the selected department in a drop down menu. On this second page users are required to select one of the displayed people and then assign them to specific task and insert it into the database. What I would like to know if there is a way that I can code the page to automatically re-execute the deaprtmentQ query without the user having to physically go back to selecting a department page. Any assistance would be greatly appreciated Quote Link to comment https://forums.phpfreaks.com/topic/280949-executing-a-query-multiple-times-in-a-page/ Share on other sites More sharing options...
davidannis Posted August 8, 2013 Share Posted August 8, 2013 You can easily pass DepartmentQ through the second form as a hidden field. <input type="hidden" name="dept" value="departmentQ"> then if (second page was submitted test here){ write to database } if (isset($_POST['dept']){ //do your query here and redisplay the list of people in Department Q here } Quote Link to comment https://forums.phpfreaks.com/topic/280949-executing-a-query-multiple-times-in-a-page/#findComment-1443953 Share on other sites More sharing options...
fastsol Posted August 8, 2013 Share Posted August 8, 2013 Pass the first form as $_GET so the department will be in the url. Then when you post the second form leave the action tag empty and it will post back to the same department cause the url will still hold the department info. Quote Link to comment https://forums.phpfreaks.com/topic/280949-executing-a-query-multiple-times-in-a-page/#findComment-1443980 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.