Responsive Contact form with php validation and transfer data to email script
Source : don't forget one think this will saved by filename.php extension its mandatory and its working online and linux based server platform.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="jumbotron text-center">
<h2>Contact form with PHP ans send data to email</h2>
<p>when you filling up the form and press send button the message will send the selected email id and show on your email's inbox</p>
</div>
<div class="container">
<div class="col-lg-12">
<form class="form" method="post" action="?"> <label>Name</label> <input type="text" class="form-control" placeholder="Name" name="name">
<br>
<label>Contact Number</label> <input type="text" class="form-control" placeholder="Contact Number" name="number">
<br>
<label>Email ID</label> <input type="text" class="form-control" placeholder="Email ID" name="email">
<br>
<label>Your Message</label> <textarea type="text" class="form-control" placeholder="Message" rows="5" name="msg"></textarea>
<br>
<input type="submit" name="send" class="btn btn-primary" value="send">
<button type="reset" class="btn btn-primary">Reset</button>
<br>
</form>
<?php
if(isset($_POST['send']))
{
$use_name = $_POST['name'];
$use_number = $_POST['number'];
$use_email = $_POST['email'];
$use_message = $_POST['msg'];
echo "
<div class='alert alert-success'>
<strong>Success!</strong> Indicates a successful or positive action.
</div>
";
$to = "viewnoor@gmail.com";
$subject = "Inquiry person $use_name";
$message = "
<html>
<head>
<title>Inquiry person $use_name</title>
</head>
<body>
<font face='arial'>
<table class='deco' width='100%' cellpadding='10' cellspacing='0' border='1' bordercolor='#555'>
<caption></caption>
<tr bgcolor='#555555'>
<th colspan='2'>
<font color='white'>
Contact Informations
</font>
</th>
</tr>
<tr>
<th align='right' width='50%'>Name</th>
<td>$use_name</td>
</tr>
<tr>
<th align='right'>Contact Number</th>
<td>$use_number</td>
</tr>
<tr>
<th align='right'>E-mail</th>
<td><a href='mailto:$use_email'>$use_email</a></td>
</tr>
<tr>
<th align='right' valign='top'>Message</th>
<td>$use_message</td>
</tr>
</table>
<p align='center'><font size='1'>Thank you for for your wonderfull copuration with our service</font></p>
<div style='background:#070;
color:#DDD; width:200px; margin:auto;
text-align:center; padding:10px;'>Thank you</div>
</font>
</body>
</html>
";
}
?>
</div>
</div>
</body>
</html>
Comments
Post a Comment