xox Posted March 29, 2011 Share Posted March 29, 2011 Hello, I have a form that has a preview, before user can preview the form inputs he must login. If he is logedin, he can see preview and continue to editing form, but after user is finished with editing his values he is redirected to "preview" page for which he must be logged in. But the problem is that variables are "empty" after redirecting back to preview. $_POST['email'] is received from login.php $_SESSION['code'] is 5 digit code generated at start, it isn't important in this issue. Here's the code: preview.php $id_user= 0; $code = $_SESSION['code']; $email = $_POST['email']; $_SESSION['email_login'] = $email; So now you can see that $email and $_SESSION['email_login'] are empty because when redirecting from "editing" to preview $_POST['email'] can't be found... Quote Link to comment https://forums.phpfreaks.com/topic/232066-how-to-avoid-overwritting-variable-value/ Share on other sites More sharing options...
Psycho Posted March 29, 2011 Share Posted March 29, 2011 if(isset($_POST['email']) && $_POST['email']!='') { $email = $_POST['email']; $_SESSION['email_login'] = $email; } elseif (isset($_SESSION['email_login'])) { $email = $_SESSION['email_login']; } else { $email = false; } Quote Link to comment https://forums.phpfreaks.com/topic/232066-how-to-avoid-overwritting-variable-value/#findComment-1193708 Share on other sites More sharing options...
xox Posted March 29, 2011 Author Share Posted March 29, 2011 grazie Quote Link to comment https://forums.phpfreaks.com/topic/232066-how-to-avoid-overwritting-variable-value/#findComment-1193731 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.