kenny22 Posted March 26, 2011 Share Posted March 26, 2011 i have set up a search form which is linked to dynamic update form on the same page, when you pick an item from listbox in form 1 it will populate form2 (update form) with the data from DB and repeat for all matching records, the update of the form is done by using a checkbox (onclick), all this works fine and DB updates fine. My problem is when i check a checkbox in any of the update forms the data is updated but all the update forms are removed so if i want to update another record i need to enter original search again to get forms to display again i know the problem is because the page is refreshing when onclick is activated and it loses the search value so returns empty form. i know you can use java to stop page refreshing but never used it before and been trying to get it to work with no success, is there any other way to keep page from refreshing Quote Link to comment https://forums.phpfreaks.com/topic/231763-no-refresh-after-update/ Share on other sites More sharing options...
hansford Posted March 26, 2011 Share Posted March 26, 2011 Not completely understanding what is going on, but if you're submitting a form, using the normal submit process, the page has to reload and cannot be stopped. You could do this with Ajax and the page wouldn't refresh, but instead your client side Javascript would make all the necessary changes after its call to the server. Quote Link to comment https://forums.phpfreaks.com/topic/231763-no-refresh-after-update/#findComment-1192468 Share on other sites More sharing options...
kenny22 Posted March 27, 2011 Author Share Posted March 27, 2011 i've narrowed down the problem to this bit of code $colname_rsTeamselect = "-1"; if (isset($_POST['team'])) { $colname_rsTeamselect = $_POST['team']; when i click to update form it reloads form using $colname_rsTeamselect = "-1"; instead of holding the previous value of $colname_rsTeamselect so i'm looking for a way to hold the value of $colname_rsTeamselect until a new $_POST['team'] is entered from search box Quote Link to comment https://forums.phpfreaks.com/topic/231763-no-refresh-after-update/#findComment-1192814 Share on other sites More sharing options...
kenny22 Posted March 27, 2011 Author Share Posted March 27, 2011 got it working by using session variable $colname_rsTeamselect = $_SESSION['category']; if (isset($_POST['team'])) { $colname_rsTeamselect = $_POST['team']; $_SESSION['category'] = $_POST['team']; may not be correct way but it works Quote Link to comment https://forums.phpfreaks.com/topic/231763-no-refresh-after-update/#findComment-1192819 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.