Search the Community
Showing results for tags 'phpcontact form'.
-
Hi. I am relatively new to using PHP and am working on building a contact form. It's pretty much good to go and it sends to my email, however, I am having the issue where it just sends this information to my email and not what the user put in, just leaving the message blank. Name: Email: Phone: Message: I'm not exactly sure what I am doing incorrectly. Also is there way to improve my code to make sure it gets in my inbox and not my spam? I've included the PHP and the HTML regarding the form. Here's the PHP. <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $formcontent=" From: $name \n Email: $email \n Phone: $phone \n Message: $message"; $recipient = "contact@immersivewebdesign.com"; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='http://immersivewebdesign.com/' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; ?> Here's the HTML form. <div class="container"> <div class="col-lg-offset-4 col-lg-4" id="panel"> <h2>Get In Touch</h2> <form action="mail.php" method="post"> <div class="group"> <input type="text" name="name" required> <span class="highlight"></span> <span class="bar"></span> <label>Name</label> </div> <div class="group"> <input type="email" email="email" required> <span class="highlight"></span> <span class="bar"></span> <label>Email</label> </div> <div class="group"> <input type="tel" phone="phone" required> <span class="highlight"></span> <span class="bar"></span> <label>Phone</label> </div> <div class="group"> <input type="text" message="message" required> <span class="highlight"></span> <span class="bar"></span> <label>Message</label> </div> <div class="group"> <center> <button type="submit" class="btn btn-warning">Send <span class="glyphicon glyphicon-send"></span></button></center> </div> </form> </div> </div> Thank you for your help.
- 4 replies
-
- phpcontact form
- html
-
(and 1 more)
Tagged with: