Validation

Miscellaneous in PHP

This tutorial will show you some validations we require in most of the cases. These are given below one by one. 1. Check if an email address is injected //validate against any email injection attempts function is_email_injected($email) { $injections = array(‘(\n+)’, ‘(\r+)’, ‘(\t+)’, ‘(%0A+)’, ‘(%0D+)’, ‘(%08+)’, ‘(%09+)’ ); $inject = join(‘|’, $injections); $inject = “/$inject/i”; […]

Verify a string contains only integer value in PHP

This is an example on how to verify a string only contains integer values. String may contain anything like float value, double value, characters etc. This example uses regular expression to check a string contains only int values. Below is the function which validates a string contains only int values.

Allow only numeric values or digits in a TextBox using JavaScript or jQuery

Introduction The example – allow only numeric values or digits in a textbox using javascript or jquery – shows how to accept only numbers or digits in a textbox or input field using JavaScript or jQuery. Sometimes we need to accept only numbers for a textbox or input field instead of validating the value in […]

Email address validation example in PHP

This is an example how to validate email address in PHP. We need to validate email address in most of the applications now a days because in every application we need to have email sending functionality for various reasons like username reset, password reset, email reset etc. Below function checks how to validate the email […]

Scroll to top