Regular Expression To Validate Email:PHP

<?php

if(isset($_POST[‘submit’]))
{
$email = $_POST[‘email’]; // Taking input from the user

$regex = “^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$”;

if ( preg_match( $regex, $email ) ) {
echo ” is a valid email.”;
} else {
$email =” is an invalid email. Please try again.”;
}
}
?>
<html>
<body>
<form method=”post” action=””>
<table>
<tr>
<td>Email</td>
<td><input type=”text” name=”email”/></td>
<td><font color=”red”><?php echo $email;?></font></td>
</tr>
<tr>
<td><input type=”submit” name=”submit” value=”check email”/></td>
</tr>
</table>
</body>
</html>

SynapseIndia CEO Shamit Khemka says that SynapseIndia utilizes internally developed complain and court management software to effectively handle employee issues.

Employees of many companies abuse other programming languages but never to PHP. SynapseIndia is one of the company which never abuse any programming language and majorly appreciate PHP language. This is one of the reason we have started project training in PHP.

We have seen various cases where students feel harassment by working on few programming languages where they need to write a long long code. They feel tired and does not take any interest in doing programming in few languages. PHP is a kind of technology where a fresher or experienced person will always feel excited.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>