geronimo Posted July 12, 2006 Share Posted July 12, 2006 1. I have a form that posts data.2. I have php script that handles data and checks for errors. If no error, it returns page with the data that was entered and a thank you.3. If there is an error: it returns the user to a blank form and exits the php script.I want:1. To at least echo an error message and return user to a blank form.2. If I could echo an error message and return user to form with the data that they entered still there, that would be better.I WANT TO USE PHP NOT JAVA SCRIPTS....etc....Here is what I have:<?if ((!$_POST[FirstName]) || (!$_POST[LastName]) ||(!$_POST[BusinessName])|| (!$_POST[Address]) || (!$_POST[Email]) || (!$_POST[Email2]) || (!$_POST[Category])){ header("Location: http//www.go.back.here/submit_your_business.html"); exit;}This checks to see if data was entered in these fields.If not: it returns user to blank form.Again: I want to echo a message and then return to the form or return to the form with the message above the form....whichever is appropriate coding.And then: if I can return the user to the form with an error message and the form still holding the data.....terrific.Thanksgeronimo Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/ Share on other sites More sharing options...
kenrbnsn Posted July 12, 2006 Share Posted July 12, 2006 To be able to present the user with a form prefilled with their entries, the script that checks the input should be the same script that presents the form.The basic flow would be:[list][*]If the form has been submitted, check for errors -- storing the error messages in a variable[*]If there are no errors -- process the data[*]If there are errors or the form hasn't been submitted yet display the form. Where ever each field can have a value, display the value retrieved from the last form submission (if any).[/list]Keb Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/#findComment-56873 Share on other sites More sharing options...
brown2005 Posted July 12, 2006 Share Posted July 12, 2006 check http://www.allinthissite.co.uk/index/index.php?page=account&action=home and on either the register or login part click submit without entering anything and tell me if thats the sort of thing u want? Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/#findComment-56884 Share on other sites More sharing options...
geronimo Posted July 12, 2006 Author Share Posted July 12, 2006 1. Maybe I should have mentioned that the FORM is an HTML page....using the Method = POST and then the ACTION calls the php script.2. Yes - as it pertains to the link: http://www.allinthissite.co.uk/index/index.php?page=account&action=homeHowever, If the user is returned to the form, I would like to be able to present the form with the data still present. If that is too much, I'll take what I can get.I'm willing to change whatever is necessary. If the form needs to be presented via php as opposed to html, I'll try to do that.Thanks for respondinggeronimo Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/#findComment-56968 Share on other sites More sharing options...
brown2005 Posted July 12, 2006 Share Posted July 12, 2006 u have msn so i can send u the scripts? Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/#findComment-56972 Share on other sites More sharing options...
geronimo Posted July 12, 2006 Author Share Posted July 12, 2006 As it pertains to:u have msn so i can send u the scripts?Not sure what you mean.Are you asking for an email address?geronimo Quote Link to comment https://forums.phpfreaks.com/topic/14400-form-data-validation-error-msg-return-to-form/#findComment-57003 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.