jesushax Posted April 21, 2009 Share Posted April 21, 2009 hi all what i want to do is for for errors my form goes to register.php and then if a field isnt filled in the page gets redirected back to regform.php but the information the user already inputted is lost so what i want to do is gather the post data in a session then if where redirected call the session and repopulate the form with the data the user just inputted anyone know how i can do this, would it be using arrays? thanks Quote Link to comment https://forums.phpfreaks.com/topic/155003-solved-put-post-data-into-a-session-then-recall-it/ Share on other sites More sharing options...
Yesideez Posted April 21, 2009 Share Posted April 21, 2009 One way is to use one script and keep posting to itself which is what I do. In your case try making hidden fields <input type="hidden" name="username" value ="joebloggs"> Use that on the page that doesn't contain your form so you can remember the data. You can also use session variables. Quote Link to comment https://forums.phpfreaks.com/topic/155003-solved-put-post-data-into-a-session-then-recall-it/#findComment-815277 Share on other sites More sharing options...
jesushax Posted April 21, 2009 Author Share Posted April 21, 2009 hmm the hidden fields thing i couldnt use because using a header(location:..) code after html causes problems, has done for me in the past anyway could i not put all the form data into one session then use an array on the regform to split the session data? just how would i do it? Quote Link to comment https://forums.phpfreaks.com/topic/155003-solved-put-post-data-into-a-session-then-recall-it/#findComment-815282 Share on other sites More sharing options...
Yesideez Posted April 21, 2009 Share Posted April 21, 2009 Multidimensional arrays. Quote Link to comment https://forums.phpfreaks.com/topic/155003-solved-put-post-data-into-a-session-then-recall-it/#findComment-815298 Share on other sites More sharing options...
jesushax Posted April 21, 2009 Author Share Posted April 21, 2009 just tried this works a treat regsiter.php $_SESSION["PostData"] = $_POST; regform.php $posts = $_SESSION["PostData"]; echo $posts["Sect1_6"]; Quote Link to comment https://forums.phpfreaks.com/topic/155003-solved-put-post-data-into-a-session-then-recall-it/#findComment-815300 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.