Validating a form with php
Many types of data—comments and addresses being just two examples—really don't have a definable pattern.
A regular expression that allows for any valid comment or address would allow for just about anything.
You can download the code and even see the demo below.
I have used the same database and table previously created in complete registration form post, copy the following code to create table in database ‘projects‘.
So skip the server-intensive regular expressions in such cases.
As a guide, regular expressions the most exacting security measure, but they're almost definitely the least efficient and possibly the most problematic.
If email or password is empty, a form will be submitted using $.ajax() and send the users value to the main login page.
You should understand that regular expressions require extra processing, so they shouldn't be used flippantly.
", and "Does the E-mail field contain a valid e-mail address syntax?
", and if filled out, "Does the Website field contain a valid URL?
The security concern lies in the fact that the PHP page handling the form will do something with the information the user enters: store it in a database, pass it along to another page, or use it in an email.
If the information the user enters is tainted, you could have a major problem on your hands. Mistakes can happen, either on purpose or by accident, that could reveal flaws in your code, cause the loss of data, or bring your entire system to a crashing halt.