I am sure I have something wrong here, but dang if I can find it. The contact form works fine except the message does not come through. Perhaps someone could put another set of eyes on it and clue me in? Thanks.
This is the HTML:
Code HTML4Strict:<form id="ContactForm" method="post" action="contact.php"> <div> <div class="wrapper"> <strong>Name:</strong> <div class="bg"><input type="text" class="input" name="Name:" ></div> </div> <div class="wrapper"> <strong>Email:</strong> <div class="bg"><input type="text" class="input" name="Email:" > </div> </div> <div class="textarea_box"> <strong>Message:</strong> <div class="bg"><textarea name="textarea" cols="1" rows="1" ></textarea> </div> </div> <a href="#" class="button" onClick="document.getElementById('ContactForm').submit()"><span><span>Send</span></span></a> <a href="#" class="button" onClick="document.getElementById('ContactForm').reset()"><span><span>Clear</span></span></a> </div> </form>
And this is the PHP behind it:
Code PHP:<?php $field_name = $_POST['Name:']; $field_email = $_POST['Email:']; $field_message = $_POST['textarea']; $mail_to = 'xxxxxxx@xxx.xxx'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_textarea; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'contact_page.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to [email]firstvirginiaservices@yahoo.com[/email]'); window.location = 'contact_page.html'; </script> <?php } ?>


Reply With Quote






Bookmarks