sorenchr Posted December 28, 2008 Share Posted December 28, 2008 Hi Im currently working on a login system, where visitors are able to create new users. When a visitor creates a new user, some form data is parsed to a file called docreate.php. If the form data does not comply with a set of rules(allowed characters, valid email etc.), the user is returned to the user creation page. What i want to do is to parse the correct entered data back to the users form, so that they dont have to type it in again, and, i want to give them a notification of what went wrong (bad username, username already exists etc.). Now, i've managed to rig up a system that uses sessions to do this, but it is awfully messy and i don't believe that it is the best way to do it. So my question is, what would be an ideal way to parse data back to the user? I've noticed Facebook keeps your form data in a javascript string(or whatever it is called), when a user enters invalid data into their forms. But that data has to be parsed into the javascript string through something, right? And all i can think of that they are using is sessions to do this. Finally, i know i could just merge the user creation page and docreate.php, but i just wanted to see here first if any of guys have experience with something that works better. Best regards Soren Christensen Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 28, 2008 Share Posted December 28, 2008 The best method is for your form and your form processing page to be the same page (the data is already present and you can simply put it back into the field values when there is an error and the form must be displayed again.) The best method if you are using two separate pages is to use session variables. Quote Link to comment Share on other sites More sharing options...
sorenchr Posted December 28, 2008 Author Share Posted December 28, 2008 Alright, thanks. Quote Link to comment Share on other sites More sharing options...
omarh2005 Posted December 28, 2008 Share Posted December 28, 2008 You may process fields with javascripts for speed and the confirmation from the important fields in seperate php file 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.