You are on page 1of 2

<?

php
$sub=$_GET['submit'];
if($sub)
{
$name=$_GET['name'];
$email=$_GET['email'];
$cn=$_GET['cn'];
$com=$_GET['com'];
if(!$name)
{
echo "<font color='red'>Name should be Enter into the Field";
}
else
{
if(!$email)
{
echo "<font color='red'>Email shoul be Enter into the Field";
}
else
{
$regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[@][A-z0-9_]+([.][A-z0-9_]+)*[.][A-
z]{2,4}$/";
if (!preg_match($regexp, $email)) {
echo "<font color='red'>Email address is <u>not</u> valid.";
} else {

if(!$cn)
{echo "<font color='red'>Contact NO. should be Enter into the Field";
}
else
{
if(strlen($cn)<11)
{
echo "<font color='red'>NO Such Number Exist";
}
else
{

$reg = "/^[0-9]+/";
if(!preg_match($reg,$cn))
{
echo "<font color='red'>Contact No should be Numeric.";
}
else
{
$to1="support@ibtech.com.pk";
$to = "sales@ibtech.com.pk";
$subject = "Contact";
$message = "Hello sir .<br/> My name is $name and my Contact Number is $cn I wan
na tell you <br/>$com";
$from = $email;
$headers = "From: $from";
mail($to,$subject,$message,$headers);
mail($to1,$subject,$message,$headers);
echo "Mail Sent";
}
}

}
}
}

?>

You might also like