Php class for form submission and validation