How To Validate Email and Url In Php





Validate Email Address In Php





$email = test($_POST["email"]);

if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

  $emailError = "Invalid email format";

}






Validate Url In Php


$website = test($_POST["website"]);

if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) {

  $websiteError = "Invalid URL";

}




thank you
team gajabwap web in hindi

ConversionConversion EmoticonEmoticon

:)
:(
=(
^_^
:D
=D
=)D
|o|
@@,
;)
:-bd
:-d
:p
:ng
:lv
Thanks for your comment