HTML and PHP Contact Us Page

This is code of Contact Us page in HTML and Php. This code is work online using webhost. You can simply take free domain and apply this code. This code is working Correctly in online domain.
Contact Us Page

<html lang="en-US">
<head>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8"/>
<title>Login</title>
</head>
<body>
<div id="main">
<div>
<form action="contactus.php" method="post">
<table width="600px" align="center" border="0">
<tr>
<td align="center"colspan="6" bgcolor="red"><h1>Contact Us</h1></td>
</tr>
<tr>
 <td align="right">Enter Your Email:</td>
 <td><input type="text" name="email"></td>
</tr>
<tr>
 <td align="right">Subject:</td>
 <td><input type="text" name="subject"></td>
</tr>
<tr>
 <td align="right">Your Message</td>
 <td><textarea cols="40" rows="10" type="text" name="message"></textarea></td>
</tr>
<tr>
 <td align="center" colspan="6"><input type="submit" name="send_email" value="Send Email"></td>
</tr>
</table>
</form>
</div>
<?php
if(isset($_POST['send_email'])){
$sender_email = $_POST['email'];
$subject= $_POST['subject'];
$mess=$_POST['message'];
$to = "write you mail@gmail.com";
$message= "Email Form".$mess;
if($sender_email=='' or $subject=='' or $mess=='')
{
echo "<script>alert('Please Fil blank Field')</script>";
exit();
}
mail($to,$subject,$message,$sender_email);
$to_sender = $_POST['email'];
$sub = "Thanks for contacting<br>";
$mesg = "Your problem is get sovled soon<br>";
$from = "write you mail@gmail.com";
mail($to_sender,$sub,$mesg,$from);
echo "<center><h2>Email Sent Get you Soon</h2></center>";

}
?>
</div>
</body>
</html>

1 comments:

Post a Comment

Total Pageviews