phone no validation using js

function validatePhone(obj,msg) { var validNum =/^[\(]?(\d{0,3})[\)]?[\s]?[\-]?(\d{3})[\s]?[\-]?(\d{4})[\s]?[x]?(\d*)$/; if (validNum.test(obj.value) == false) { alert(msg); obj.focus(); obj.select(); return false; } return true; }

Php Server side security using preg_match.

To avoid the cross side scripting or make site safe from hacker attacks one need to perform data validation before allowed data insertion into database . We can achieve this using php preg_match which check data format to see whether it is in valid state or not. The following code snippet is standard validation example [...]

Follow

Get every new post delivered to your Inbox.