<table cellpadding="0" cellspacing="15" style="margin:0 0 0 20px; color: #fff;" id="contact" >
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td id="table_data" width="120">Name :</td>
<td id="table_data1" width="30"> </td>
<td id="table_data2" width="100"><input id="input_text" type="text" value="" name="name" style="width:200px;height:20px; " /></td>
</tr>
<tr>
<td>Email ID :</td>
<td> </td>
<td><input id="input_text" type="text" value=" " name="email" style="width:200px;height:20px; " /></td>
</tr>
<tr>
<td>Company Name :</td>
<td> </td>
<td><input id="input_text" type="text" value=" " name="company" style="width:200px;height:20px; " /></td>
</tr>
<tr>
<td>Subject :</td>
<td> </td>
<td><input id="input_text" type="text" value="" name="sub" style="width:200px;height:20px; " /></td>
</tr>
<tr>
<td>Messages :</td>
<td> </td>
<td><textarea id="input_text" rows="2" cols="15" value="" name="msg" style=" width:200px;height:50px; max-width:200px; max-height:50px;" /></textarea></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" id="submit_button" value="submit" /></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['company']) && isset($_POST['sub']) && isset($_POST['msg'])){
$name = $_POST['name'];
$emailId = $_POST['email'];
$company = $_POST['company'];
$subject = $_POST['sub'];
$message = $_POST['msg'];
if( !empty($name) && !empty($emailId) && !empty($company) && !empty($subject) && !empty($message) ) {
$to = "info@kalpataruexhibition.com";
$mail_id = " ";
$subject = "contact us";
$messages = "Name : ".$name."mailid : ".$emailId."company name : ".$company."subject : ".$subject."message : ".$message;
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$name."<".$emailId.">\n";
$headers .= "Reply-To:<".$emailId.">\n";
$headers .= "To:<".$to.">\n";
$headers .= "Subject:<".$subject.">\n";
$headers .= "Mailed-By:<".$emailId.">\n";
$headers .= "X-Mailer: PHP/".phpversion()."\n";
if(mail($to, $subject , $messages , $headers)){
echo "<script>alert('Message sent successfully');</script>";
}
else{
echo "<script>alert('Message sent unsuccessfully');</script>";
}
}
else{
echo "<script>alert('All Fields are required');</script>";
}
}
?>
No comments:
Post a Comment