html - PHP not sending email for contact form -
this question has answer here:
after filling in required fields contact form supposed process information inputted user , sent off in email format receiver in instance website owner. after page auto refreshes nothing happens. appreciated. have included code below has php embedded.
<!doctype html> <html lang="en"> <head**strong text**> <meta charset="utf-8"> <title>contact - dream occasions</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"> <link rel="icon" href="images/favicon.ico" type="image/x-icon"> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="css/contact.css"> <link rel="stylesheet" href="https://www.w3schools.com/lib/w3.css"> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> </head> <body> <div class="navbar-wrapper"> <div class="container"> <nav class="navbar navbar-inverse navbar-static-top"> <div class="navbar-header"> <a class="navbar-brand">dream occasions</a> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="index.html">home</a></li> <li><a href="services.html">services</a></li> <li><a href="gallery.html">gallery</a></li> <li class="active"><a href="contact.html" style="background-color:#3366ff">contact</a></li> <div class="header-icons"> <li><a href="https://www.facebook.com/irelanddreamoccasions/"><i class="fa fa-facebook"style="font-size: 0.90em;"></i></a></li> <li><a href="#"><i class="fa fa-instagram"style="font-size: 0.90em; padding-left:20px;"></i></a></li> <li><a href="https://www.pinterest.com/sconboy2002/?eq=suzanne%20conboy&etslf=10321"><i class="fa fa-pinterest"style="font-size: 0.90em; padding-left:20px;"></i></a></li> </ul> </li> </ul> </div> </div> </div><!-- /container --> </div> <div class="contact"> <form id="contact" action="" method="post"> <h3>get in touch</h3> <h4>contact free consultation.</h4> <fieldset> <input placeholder="your name" type="text" name="name" tabindex="1" required autofocus> </fieldset> <fieldset> <input placeholder="your email address" type="email" name="email" tabindex="2" required> </fieldset> <fieldset> <input placeholder="your phone number (optional)" type="tel" name="tel" tabindex="3"> </fieldset> <fieldset> <textarea placeholder="type message here...." name="message" tabindex="5" required></textarea> </fieldset> <fieldset> <button name="submit" type="submit" id="contact-submit" data-submit="...sending">submit</button> </fieldset> </form> </div> <?php if(isset($_post['submit'])){ $to = "dreamoccasions@eircom.net"; // email address $from = $_post['email']; // sender's email address $name = $_post['name']; $tel = $_post['tel']; $submit = $_post['submit']; $subject = "form submission"; $subject2 = "copy of form submission"; $message = $name . " wrote following:" . "\n\n" . $_post['message']; $message2 = "here copy of message " . $name . "\n\n" . $_post['message']; $headers = "from:" . $from; $headers2 = "from:" . $to; mail($to,$subject,$message,$headers); mail($from,$subject2,$message2,$headers2); echo "mail sent. thank " . $name . ", contact shortly."; } ?> <footer class="footer-distributed"> <div class="footer-left"> <p class="footer-links"> <a href="index.html">home</a> <a href="services.html">services</a> <a href="gallery.html">gallery</a> <a href="contact.html">contact</a> </p> </div> <div class="footer-center"> <span>contact us</span> <div> <i class="fa fa-map-marker"></i> <p>edgeworthstown, co.longford</p> </div> <div> <i class="fa fa-phone"></i> <p>telephone @ - 0868558521</p> </div> <div> <i class="fa fa-envelope"></i> <p>dreamoccasions@eircom.net</p> </div> </div> <div class="footer-right"> <p class="footer-company-about"> <span>connect us</span> <p>on our numerous social medias keep date.</p> </p> <div class="footer-icons"> <a href="https://www.facebook.com/irelanddreamoccasions/"><i class="fa fa-facebook"></i></a> <a href="#"><i class="fa fa-instagram"></i></a> <a href="https://www.pinterest.com/sconboy2002/?eq=suzanne%20conboy&etslf=10321"><i class="fa fa-pinterest"></i></a> </div> </div> <hr> <p class="footer-company-name"><span>dream occasions © 2017. rights reserved.</span> <span>site developed joel conboy</span> <?php echo date("y"); ?> </p> </footer> </body> </html>
you have <button name="submit"
checking if(isset($_post['submit'])){
. have case mismatch. call button submit
instead , should work.
Comments
Post a Comment