Search the Community
Showing results for tags 'enquiry'.
-
Hi Guys, I'm no expert with this but I have the code below to fill in an enquiry form & send an E-mail but its not working. Only two fields are required (the name & E-mail address) but each time I get the error message 'There was a problem with sending the form. Please check to ensure you have filled in all the fields.' Everything I try & change I cannot get it to work, - any ideas? <?php $SENT = false; if ($_POST && $_POST["name"] && eregi("^[a-zA-Z0-9 ]+$", $_POST["name"]) && $_POST["email"] && eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST["email"])) { $recipient = "me@mydomain.com"; $recipient = "enquiries@mydomain.com"; $subject = "Enquiry from the Website"; $email_header = "From: " .$_POST["email"]. " (" .$_POST["name"]. ")\r\n"; "Reply-To: " .$_POST["email"]. ""; // build the email $s = "The following contact form has been submitted:\n\n"; $s .= "=== Customer Details =====\n"; $s .= "Name: " .$_POST["name"]. "\n"; $s .= "Company: " .$_POST["company"]. "\n"; $s .= "Telephone: " .$_POST["telephone"]. "\n"; $s .= "Email Address: " .$_POST["email"]. "\n\n"; $s .= "=== Enquiry Information =====\n"; $s .= trim($_POST["comments"])."\n\n"; $s.= "Generated: " .date("Y-m-d H:i:s"); $email = wordwrap($s, 72). "\n\n\n"; // wrap text to 72 characters if (@mail($recipient, $subject, $email, $email_header)) { $SENT = true; } else { $SENT = false; } } ?> \\Rest of HTML code here... <? if (!$SENT) { ?> <? if (!$SENT && $_POST) { ?> <p class="red">There was a problem with sending the form.<br />Please check to ensure you have filled in all the fields.</p> <? } ?> <p><b>Enquiry Form</b><br /> <span class="red">**</span> Indicates required fields</p> <form name="contact" action="contact.php" method="post"> <fieldset class="conform"> <legend>Your Details</legend><br /> <label for="name">Name</label> <input id="name" type="text" size="40" value="<?php echo (isset($_POST["name"])) ? $_POST["name"] : '' ; ?>" name="name" /> <span class="red">**</span><br /> <label for="company">Company</label> <input id="company" type="text" size="40" value="<?php echo (isset($_POST["company"])) ? $_POST["company"] : '' ; ?>" name="company" /><br /> <label for="telephone">Telephone</label> <input id="telephone" type="text" size="40" value="<?php echo (isset($_POST["telephone"])) ? $_POST["telephone"] : ''; ?>" name="telephone" /><br /> <label for="email">Email Address</label> <input id="email" type="text" size="40" value="<?php echo (isset($_POST["email"])) ? $_POST["email"] : ''; ?>" name="email" /> <span class="red">**</span><br /> </fieldset> <fieldset class="conform2"> <legend>Further Information</legend><br /> <textarea id="comments" name="comments" size="40" rows="8" cols="50"><?php echo(isset($_POST["comments"])) ? $_POST["comments"] : '' ; ?></textarea> </fieldset> <br /> <a href="javascript:document.contact.submit();"><img title="" height="43" alt="" src="images/submit.gif" width="102" border="0" /></a> </form> </div> <? } else { ?> <p>Thank you for your enquiry. We will reply as soon as possible.</p> <? } ?>