Webjunkie Posted July 5, 2014 Share Posted July 5, 2014 I have a standard form that displays users current data from a mysql database once logged in(code obtained from the internet). Users can then edit their data then submit it to page called editform.php that does the update. All works well except that the page does not display the updated info. Users have to first logout and login again to see the updated info. even refreshing the page does not show the new info. Please tell me where the problem is as i am new to php. my form page test.php <?PHP require_once("./include/membersite_config.php"); if(!$fgmembersite->CheckLogin()) { $fgmembersite->RedirectToURL("login.php"); exit; } ?> <form action="editform.php?id_user=<?= $fgmembersite->UserId() ?>" method="POST"> <input type="hidden" name="id_user" value="<?= $fgmembersite->UserId() ?>"><br> Name:<br> <input type="text" name="name" size="40" value="<?= $fgmembersite->UserFullName() ?>"><br><br> Email:<br> <input type="text" name="email" size="40" value="<?= $fgmembersite->UserEmail() ?> "><br><br> Address:<br> <input type="text" name="address" size="40" value="<?= $fgmembersite->UserAddress() ?> "><br><br> <button>Submit</button> my editform.php <?php $con = mysqli_connect("localhost","root","user","pass"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } mysqli_query($con,"UPDATE fgusers3 SET name = '".$_POST['name']."', email= '".$_POST['email']."', address= '".$_POST['address']."' WHERE id_user='".$_POST['id_user']."'"); header("Location: test.php"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/289449-stack-overflow-questions-tags-users-badges-unanswered-ask-question-page-not-showing-database-updated-info-but-database-is/ Share on other sites More sharing options...
fastsol Posted July 5, 2014 Share Posted July 5, 2014 Well those codes blocks don't have anything to do with the displaying of the info you updated. Most likely the issue is that the script (somewhere else in the code) is gathering the users info and storing it in a session. Then on each page load it just re-uses that info rather than making another query until the browser is closed or the user logs out and back in. So you would need to find and edit how that info is being stored and displayed. Quote Link to comment https://forums.phpfreaks.com/topic/289449-stack-overflow-questions-tags-users-badges-unanswered-ask-question-page-not-showing-database-updated-info-but-database-is/#findComment-1483957 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.