Crew-Portal Posted August 4, 2007 Share Posted August 4, 2007 Hi I am making a website that has a user registration. All files on the site have a error handling system that displays the error at the top of the page if a form is handled incorectly. I have just been using scripts like if $_POST[name] == NULL {$errormsg = Name is not filled } Now I realize that script is wrong but thats not the point. Whenever there is an error it gets called as a diffrent variable and that is displayed at the top of the page and if the error equals Null as in unassigned it displays nothing! This process works fine but it only displays one error and exits the script. I would like to know how to make a error handling system that will display all errors at one something like: Username Not Filled. Password Incorrect. Email Not Entered. Something like that displaying all the errors on a form at one time Quote Link to comment https://forums.phpfreaks.com/topic/63330-custom-erro-handling/ Share on other sites More sharing options...
pyrodude Posted August 4, 2007 Share Posted August 4, 2007 Personally, I use sessions for my error-handling. However, one option would be to initialize $errormsg to NULL at the begining of the script, then use $errormsg .= "Username not entered<br />"; This will contatenate the messages, and the <br /> will insert a break (future error messages will be printed on the next line) Quote Link to comment https://forums.phpfreaks.com/topic/63330-custom-erro-handling/#findComment-315600 Share on other sites More sharing options...
Crew-Portal Posted August 4, 2007 Author Share Posted August 4, 2007 K Thanks Ill Try That! But I dont want them to stay the entire session just until the page changes! Quote Link to comment https://forums.phpfreaks.com/topic/63330-custom-erro-handling/#findComment-315606 Share on other sites More sharing options...
pyrodude Posted August 4, 2007 Share Posted August 4, 2007 Your method should still work. Anytime I output the $_SESSION['failmessage'] on mine, I then unset($_SESSION['failmessage']); My script bounces to several pages, and I want the data to be available for the "final resting place" of the client, so to speak. Quote Link to comment https://forums.phpfreaks.com/topic/63330-custom-erro-handling/#findComment-315612 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.