Validating form with php

To quickly accomplish this, add the Sometimes you may wish to add validation rules based on more complex conditional logic.For example, you may wish to require a given field only if another field has a greater value than 100.

However, if the user only changes the name field and not the e-mail field, you do not want a validation error to be thrown because the user is already the owner of the e-mail address.

In the case of a traditional HTTP request, a redirect response will be generated, while a JSON response will be sent for AJAX requests. Again, if the validation fails, the proper response will automatically be generated.

If the validation passes, our controller will continue executing normally.

Or, you may need two fields to have a given value only when another field is present.

Adding these validation rules doesn't have to be a pain.

Leave a Reply