Send me a message




HTML Code

<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <div class="container" style="background-color:grey; text-align:center; "> <h4><u>Send me a message</u></h4> <form id="contactForm" action="send_form_email.php" method="post"> <div class="row"> <div class="col-md-6 form-group"> <span style="background-color: #FFFF00"><input type="text" class="form-control" name="senderName" id="senderName" placeholder="name"></span><br/> <input type="email" class="form-control" name="senderEmail" id="senderEmail" placeholder="e-mail"><br/> <input type="text" class="form-control" name="subject" id="subject" placeholder="Subject"> </div> <div class="col-md-6 form-group"> <textarea name="message" class="form-control" id="message" placeholder="Message"></textarea> </div> <div class="col-md-12 form-group"> <button type="submit">Send Message</button> </div> </div> </form> </div>

send_form_email.php

<? $to = "info@yourdomain.com"; $from = ""; $subject = ""; $message = ""; if (isset($_POST["senderEmail"])) { $from = $_POST["senderEmail"]; // sender $name = $_POST["senderName"]; $subject = $_POST["subject"]; $message.="Name: "; $message.=$_POST['senderName'] . "<br/>"; $message.="Message: "; $message .= $_POST['message']; $headers = "From: $from\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $message, $headers); } header('Location: http://www.yourdomain.com'); ?>