Nightkon Posted May 28, 2007 Share Posted May 28, 2007 Hi All, I have a form which when updated takes the user to an update screen. I was wondering if it was possible to redirect the user back to the screen where they entered the information and refresh the data basically just refreshing the page (and obviously updating the data in the database which is working fine). I have tried using some code and I can easily redirect back to the right page but I also need to have the 'id' selected so that it displays the recently updated record. Below is the code I attempted to use (i have tried everything I can think of). Any help would be appreciated. header('Location: OrganiseIDASX.php?id=echo $_GET[$id]'); Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/ Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 try <?php header("Location: OrganiseIDASX.php?id={$_GET[$id]}"); ?> if this fails what error, also we really need to see more code Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/#findComment-263261 Share on other sites More sharing options...
Nightkon Posted May 28, 2007 Author Share Posted May 28, 2007 Hi MadTechie, thanks for your help. The full code I am using in the update.php file is: <?php include ('./mysql_connect.php'); $rrr_score = $_POST['rrr_score']; $bs_score = $_POST['bs_score']; $frs_score = $_POST['frs_score']; $fs_score = $_POST['fs_score']; $strength_summary = $_POST['strength_summary']; $ms_score = $_POST['ms_score']; $id = $_POST['id']; $query = "UPDATE company SET rrr_score = '$rrr_score', bs_score = '$bs_score', frs_score = '$frs_score', fs_score = '$fs_score', ms_score = '$ms_score', strength_summary = '$strength_summary' WHERE FileSerial= '$id'"; $result = mysql_query($query); header("Location: OrganiseIDASX.php?id={$_GET[$id]}"); mysql_close($link); ?> Using the code you provided returns the following in the URL: http://localhost:8888/OrganiseIDASX.php?id= Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/#findComment-263319 Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 Ahh your using post and have already grabbed the ID so try header("Location: OrganiseIDASX.php?id=$id"); Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/#findComment-263323 Share on other sites More sharing options...
Nightkon Posted May 28, 2007 Author Share Posted May 28, 2007 Works fantastic! Thanks again MadTechie Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/#findComment-263336 Share on other sites More sharing options...
MadTechie Posted May 28, 2007 Share Posted May 28, 2007 welcome please click solved (bottom left) Quote Link to comment https://forums.phpfreaks.com/topic/53273-simple-question-regarding-page-redirection/#findComment-263359 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.