NerdConcepts Posted September 4, 2007 Share Posted September 4, 2007 I've looked everywhere and cannot find my answer. After a successful form submission it tells the admin it was successful but then I want the form to clear out. Because I do have it where the data is redisplayed in the form just in case of an error. But when there isn't an error and the form is processed it still shows the POST data...anyway to clear this out? Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted September 4, 2007 Share Posted September 4, 2007 Please show your code. All you do is take out the the post date from the <input value="...">. Its all in the code... Quote Link to comment Share on other sites More sharing options...
trq Posted September 4, 2007 Share Posted September 4, 2007 Sounds more like a logic problem to me. Why are you displaying the form again after success? Quote Link to comment Share on other sites More sharing options...
teng84 Posted September 4, 2007 Share Posted September 4, 2007 use header file or unset Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted September 4, 2007 Share Posted September 4, 2007 Sounds more like a logic problem to me. Why are you displaying the form again after success? Thorpe is completely right. You should code php in such a way that if success is performed then a messag is shown and no inputs... Here is an example of self processing form: <?php if (isset($_POST['submit'])) { process form... Create an array $error and store error messages corresponding to a key. - if an error occurs // If errors were made... If (is_array($error)) { Show form with errors } else { echo "Success. Form submitted without errors!"; } } else { show form... } ?> Quote Link to comment Share on other sites More sharing options...
teng84 Posted September 4, 2007 Share Posted September 4, 2007 Sounds more like a logic problem to me. Why are you displaying the form again after success? Thorpe is completely right. You should code php in such a way that if success is performed then a messag is shown and no inputs... Here is an example of self processing form: <?php if (isset($_POST['submit'])) { process form... Create an array $error and store error messages corresponding to a key. - if an error occurs // If errors were made... If (is_array($error)) { Show form with errors } else { echo "Success. Form submitted without errors!"; } } else { show form... } ?> i believe what he wants is to remove the post data on each form and have the form empty with the message success i guess it should be if (isset($POST['button'])) { do something if sucess--- header('location: put the same address here to remove the post data'); else retain the post data or dont do the header file } Quote Link to comment Share on other sites More sharing options...
Fadion Posted September 4, 2007 Share Posted September 4, 2007 Im with teng84's opinion. He has textboxes filled with post values in case the submit doesnt pass validation, so the user doesnt have to refill the info. A redirect will do it, with header() or meta refresh. Quote Link to comment Share on other sites More sharing options...
NerdConcepts Posted September 4, 2007 Author Share Posted September 4, 2007 The header (redirect) is what I'm going with. I just know that clients will get tired of forgetting to fill in a value, hitting submit and then having to retype all the information and select all the photos again. Thanks. Quote Link to comment Share on other sites More sharing options...
d22552000 Posted September 4, 2007 Share Posted September 4, 2007 header("REDIRECT 201 (ADDPAGENAMEHERE)"); This iwll redirect with the status code "CONTINUE" which will keep the browser waiting untill the next page says its loaded fine, if the page it redirects to doesnt load then it iwll point the user bakc to the form. Quote Link to comment 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.