Good morning all,
I have been having some EXCRUCIATINGLY awful issues with my php code. I have been working pretty freakin hard to sort this dang thing out. So my question is, why is it not giving a result under the "Send Feedback" button and why is it sending me messages with only the message, no sender, no contact information.
E-mail Code: <?php if(isset($_POST["submit"])){ //Checking for blank Fields.. if($_POST["vname"]==""||$_POST["vemail"]==""||$_POST["vcompany"]==""|| $_POST["vphonenumber"]==""||$_POST["msg"]==""){ echo "Please fill out all fields. Thank you."; }else{ // Check if the "Sender's Email" input field is filled out $email=$_POST['vemail']; // Sanitize e-mail address $email =filter_var($email, FILTER_SANITIZE_EMAIL); // Validate e-mail address $email= filter_var($email, FILTER_VALIDATE_EMAIL); if (!$email){ echo "Invalid Sender's Email"; } else{ $subject = $_POST['Form Submission']; $message = $_POST['msg']; $headers = 'From:'. $email2 . "\r\n"; // Sender's Email $headers .= 'Cc:'. $email2 . "\r\n"; // Carbon copy to Sender // message lines should not exceed 70 characters (PHP rule), so wrap it $message = wordwrap($message, 70); // Send mail by PHP Mail Function mail("[email protected]", $subject, $message, $headers); echo "Your mail has been sent successfuly ! Thank you for reaching out to us!"; } } } ?>
Contact Form Code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> <title>CompanyName - PageName</title> <meta http-equiv="Content-Language" content="en-us" /> <meta http-equiv="imagetoolbar" content="no" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="description" content="Description" /> <meta name="keywords" content="Keywords" /> <meta name="author" content="Sarah Conklin" /> <style type="text/css" media="all">@import "css/master.css";</style> <style type="text/css" media="all">@import "css/master.css";</style> </head> <body> <div id="logo"> <img src="images/AIRMANa.png" />LOGO GOES HERE<br /><br/> </div> <ul> <li><a href="index.html">Home</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Directions</a></li> </ul> <div id="page-container"> <div id="content"> <!-- feedback form starts here --> <p align="center"> <div id="feedback" align="center"> <!-- heading of the form --> <h3>Contact Form</h3> <p>This is Contact form. Send us an e-mail and we will get right back to you!</p> <!-- feedback form form --> <p class="clear" align="center"> <form id="form" action="#" method="post"> <input type = "text" name="vcompany" value="" placeholder="Your Company" /> <input type = "text" name="vname" value="" placeholder="Your Name"/> <input type = "text" name="email2" value="" placeholder="Your Email"/> <input type = "text" name="vphonenumber" value="" placeholder="Your Phone Number" /> <br /><label>Your Comments</label><br /> <textarea name="msg" placeholder="Type your text here..."></textarea> <input type="submit" name="submit" id="send" value="Send Feedback"/> </form> <h3><?php include "secure_email_code.php"?></h3> </p> </div> </p> </div> <div id="footer"> <h4>AIRMAN USA Corporation • PO Box 1130 • 42 Interational PKWY • Adairsville, GA 30103</h4> </div> </div> </body> <!-- body ends here --> </html>
Thank you for any help.