JohnMike Posted March 2, 2011 Share Posted March 2, 2011 Dear All, I am sure that this is a really basic question. However I cannot see the way forward and would like some help. If we accept that the best practice is not to self call a form but to process the form in a separate php file then if the form fails validation how do we return to the form and display the appropriate information to be edited. I have attempted to use $_SESSION to save the $_POST and use a header function to redirect the flow upon failure of validation is this the correct approach? If anyone can advise or point me in the direction of a suitable tutorial I would be very grateful Regards Link to comment https://forums.phpfreaks.com/topic/229352-form-validation-and-redirection/ Share on other sites More sharing options...
gizmola Posted March 2, 2011 Share Posted March 2, 2011 There is no problem using a self posting form. If the form exists by itself, it actually solves a lot of problems. Most forms do not exist in a vacuum however -- they exist within the ecosystem of a larger web application, and for that reason, people use frameworks that typically employ the MVC pattern, and in that case a form is like any other view, only more complicated because you have the issues of data cleansing and validation. My suggestion would be to look at the mvc and form classes of zend framework or symfony and look at how they have approached the problem. With that said you can extrapolate answers to your question looking at my reply to this thread http://www.phpfreaks.com/forums/index.php?topic=325765.msg1535081#msg1535081 Link to comment https://forums.phpfreaks.com/topic/229352-form-validation-and-redirection/#findComment-1181732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.