Perfidus Posted March 20, 2009 Share Posted March 20, 2009 Hello there ! I'm sending a big a form to be stored in DDBB, after storing the user is headed by header(location:"whatever.php") to a wellcoming page, but whenever is an error on the mysql query and datas can't be stored on DDBB, I would like the user to be sended back to the form page and to find all the fields already filled by reusing the $_POST[] vars. Is it possible? Can $_post[] array be re-sended? Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/ Share on other sites More sharing options...
premiso Posted March 20, 2009 Share Posted March 20, 2009 Put the data into session and check if the session isset if it is put that variable back in the box. Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789517 Share on other sites More sharing options...
Perfidus Posted March 20, 2009 Author Share Posted March 20, 2009 That's a good point, but remember form is a big one with several textareas, wont this be too much for $_SESSION vars? Can I store the array itself as a $_SESSION var rather than every single var one by one? Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789555 Share on other sites More sharing options...
premiso Posted March 20, 2009 Share Posted March 20, 2009 Sessions are stored on a file on the server. It can hold massive amounts of data without worry. Plus it is all text, I take it, and text holds no space at all. You can store it in the session as an array or as individual vars, it is up to you. Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789559 Share on other sites More sharing options...
Perfidus Posted March 20, 2009 Author Share Posted March 20, 2009 Thanks a lot Premiso, I'm going to put my hands on it now ! Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789658 Share on other sites More sharing options...
mrMarcus Posted March 20, 2009 Share Posted March 20, 2009 you just need some better error handling. only have the user redirected upon a successful database query. if the query is a success, redirect...if not, back to the form they go. will save all that other unnecessary business. Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789794 Share on other sites More sharing options...
mrMarcus Posted March 20, 2009 Share Posted March 20, 2009 oh, and in your form input fields be sure to have something like this... <input type="text" name="whatever" value="<?php echo $_POST['something']; ?>" /> that way, when the user is back at the form, any inputted values will be present in the input field's. you can do textarea as well. Quote Link to comment https://forums.phpfreaks.com/topic/150333-sending-_post-vars-back-to-the-form-page/#findComment-789798 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.