Search code examples
phpserver-side-validation

return post data on server side validation failure


I have a large registration form and if a user makes any mistake and failed on server side validation then how could I show up the fields which were previously correct.

How can I send the post data back to the registration form?


Solution

  • Store the POST values in session on your action page. In your html check if session value exists and then echo that. Expire the session once you are clear with server side validation.