Validating forms using php


Validation for non-empty, alphabets and whitespace only The following code is added within the form So, if you try to understand how to write code for it step by step, step 1 is to declare the mail address to whom you want to send mail, step 2 is to write subject of the mail, step three is to collect data from POST so that you can write them to the body of mail, step 4 is to declare the mail id from which the mail is coming and finally sent mail with PHP mail() function.

You may print some message after sending mail optionally.

When there are many fields in the form, the PHP validation script becomes too complex.

As you have seen in the previous tutorial, the process of capturing and displaying the submitted form data is quite simple.Note: You can make web forms quickly with Simfatic Forms.Simfatic Forms helps you to make complete, feature rich web forms and get it online quickly. This generic PHP form validator script makes it very easy to add validations to your form.We create and associate a set of “validation descriptors” with each element in the form.The “validation descriptor” is a string specifying the type of validation to be performed.Form security (preventing exploits like SQL injection, XSS attacks etc ) are to be handled in addition to form validation.

You must have an account to comment. Please register or login here!