Whats wrong with this code!

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.

I’m guessing it must be something in the first part but 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\
";
		"Reply-To: " .$_POST["email"]. "";

	// build the email
	$s = "The following contact form has been submitted:\
\
";

	$s .= "=== Customer Details =====\
";
	$s .= "Name: " .$_POST["name"]. "\
";
	$s .= "Company: " .$_POST["company"]. "\
";
	$s .= "Telephone: " .$_POST["telephone"]. "\
";
	$s .= "Email Address: " .$_POST["email"]. "\
\
";

	$s .= "=== Enquiry Information =====\
";
	$s .= trim($_POST["comments"])."\
\
";

	$s.= "Generated: " .date("Y-m-d H:i:s");

	$email = wordwrap($s, 72). "\
\
\
"; // 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>
			<?
				}
			?>

The problem is:

<? 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>
<? } ?>

No matter what the if clause returns, the code exits php, prints the html and returns to php.

The solution is:

<?php if (!$SENT && $_POST) {
    echo '<p class="red">There was a problem with sending the form.<br />
    Please check to ensure you have filled in all the fields.</p>';
} ?>

Thanks for your reply, - I have made the changes as you suggest but am still getting the same error! Any other ideas? thanks

Put var_dump($SENT, $_POST); right above your if statement (inside PHP tags) and tell us what that outputs.

When do you get the error? On entry? After submitting the form?

What I changed solved the problem on first entry but there can be other bugs in the code. One has to be methodical looking for bugs. For example, do you know what the form returns? Probably not but you could find out by adding a

print_r($_POST);

or

var_dump($_POST);

statement to the top of the action page. Only by examining the evidence can you clear up the mystery. :wink:

I get the error after submitting the form, i.e. fill in the details, press submit & then receive the ‘There was a problem with sending the form.
Please check to ensure you have filled in all the fields.’ error message. Whatever I seem to change this message is always returned!

Putting that code in at the top seemed to return NULL array(0) { } or bool(false) array(0) { }

No idea what this means! any ideas? thanks

Also receiving this:

NULL array(5) { [“name”]=> string(9) “test name” [“company”]=> string(12) “test company” [“telephone”]=> string(11) “01234567890” [“email”]=> string(15) “me@mydomain.com” [“comments”]=> string(5) "test " }

Okay, $SENT is always NULL. So we need to determine why that is. Is there more code that you are not showing us? Is all of this code in the same file (contact.php)?

Ok this is the whole of the Contact.php file. There was more code that I removed (HTML) but here is all of it - ive just removed names:

The problem is the short php tags. Look what the browser sees:



\\\\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="form.php" method="post">
            <fieldset class="conform">
            <legend>Your Details</legend><br />
            <label for="name">Name</label>
            <input id="name" type="text" size="40" value="" name="name" /> <span class="red">**</span><br />
            <label for="company">Company</label>
            <input id="company" type="text" size="40" value="" name="company" /><br />
            <label for="telephone">Telephone</label>
            <input id="telephone" type="text" size="40" value="" name="telephone" /><br />
            <label for="email">Email Address</label>
            <input id="email" type="text" size="40" value="" 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"></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>
            <?
                }
            ?>

So is that the <? an ?> ? What do I need to do, change all of these? And to what <?php?

@captainccs ; Not really. If the server is setup to support short tags, the code works fine (I tested it locally, and it worked fine)…

@lee_sov ; Check that your server is setup to use the short tags for PHP (the <?), other wise convert all <? to be <?php and see if it works.

Try this simplified version that has been tested:

  1. then add the clever bits one at a time:
  2. remove debug stuff when everything is working to your satisfaction

<?php
    // REM NEXT LINE TO RESET _POST
    $_POST = array();
?>
<!doctype html>
<head>
    <title>fred</title>
    <style type='text/css'>
    label {display:inline-block; width:6em; text-align:right; padding:0.42em 1em 0;}
    </style>
</head>
<body>
<?php
error_reporting(-1);ini_set('display_errors',1);
echo '<pre>';
  print_r($_POST); // var_dump($_POST_);
echo '</pre>';

$SENT = false;
if (
    $_POST
    && $_POST["name"]
    && $_POST["email"]
    #&& eregi("^[a-zA-Z0-9 ]+$", $_POST["name"])
    #&& 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\
"
                    . "Reply-To: "
                    .   $_POST["email"]. "";

    // build the email
    $s  = "The following contact form has been submitted:\
\
";
    $s .= "=== Customer Details =====\
";
    $s .= "Name: "          .$_POST["name"]     . "\
";
    $s .= "Company: "       .$_POST["company"]  . "\
";
    $s .= "Telephone: "     .$_POST["telephone"]. "\
";
    $s .= "Email Address: " .$_POST["email"]    . "\
\
";
    $s .= "=== Enquiry Information =====\
";
    $s .= trim($_POST["comments"])."\
\
";
    $s .= "Generated: " .date("Y-m-d H:i:s");

    $email = wordwrap($s, 72). "\
\
\
"; // wrap text to 72 characters

    if (@mail($recipient, $subject, $email, $email_header)) {
        $SENT = true;
    } else {
        $SENT = false;
    }
}

//Rest of HTML code here...
if (!$SENT) { ?>

    <?php 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>
    <?php } ?>

    <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 />
        <!-- REMOVED  size="40" -->
        <textarea id="comments" name="comments" rows="8" cols="50">
            <?php  echo(isset($_POST["comments"])) ? $_POST["comments"] : '' ; ?>
        </textarea>

        <br />
        <a href="javascript:document.contact.submit();">
            <img title="" height="43" alt="" src="images/submit.gif" width="102" />
        </a>
        <input type="submit" value="Submit" />
    </fieldset>
  </form>

  <?php } else { ?>
      <p>Thank you for your enquiry. We will reply as soon as possible.</p>
  <?php } ?>
</body>
</html>

The code worked for me as soon as I switched to long php tags. While short tags can be enabled it’s a safer bet to use long tags. If the code gets moved to a different server it might break again.

Long tags: <?php your code ?>

Also eregi is deprecated so you should use preg_match

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"])) {

would become

if ($_POST && $_POST["name"] && preg_match("/^[a-zA-Z0-9 ]+$/i", $_POST["name"]) && $_POST["email"] && preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i", $_POST["email"])) {

There are other things than can be improved in that script:

Better error reporting (specify the problem)
Eliminate the Javascript submit and use a regular submit type input

Ok so I’ve changed all short tags to long & used preg_match instead of eregi, - still no change!!

could this be some kind of server/host issue why its not working?

Works fine for me. Make sure you fill out the name and e-mail address correctly.


<?php

$SENT = false;
if ($_POST && $_POST["name"] && preg_match("/^[a-zA-Z0-9 ]+$/i", $_POST["name"]) && $_POST["email"] && preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i", $_POST["email"])) {

	$recipient = "test@.co.uk";
	$recipient = "enquiries@.co.uk";
	$subject = "Enquiry from the  Website";
	$email_header = "From: " .$_POST["email"]. " (" .$_POST["name"]. ")\\r\
".
		"Reply-To: " .$_POST["email"]. "";

	// build the email
	$s = "The following contact form has been submitted:\
\
";

	$s .= "=== Customer Details =====\
";
	$s .= "Name: " .$_POST["name"]. "\
";
	$s .= "Company: " .$_POST["company"]. "\
";
	$s .= "Telephone: " .$_POST["telephone"]. "\
";
	$s .= "Email Address: " .$_POST["email"]. "\
\
";

	$s .= "=== Enquiry Information =====\
";
	$s .= trim($_POST["comments"])."\
\
";

	$s.= "Generated: " .date("Y-m-d H:i:s");

	$email = wordwrap($s, 72). "\
\
\
"; // wrap text to 72 characters

	if (@mail($recipient, $subject, $email, $email_header)) {
		$SENT = true;
	} else {
		$SENT = false;
	}
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
	<title></title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta http-equiv="imagetoolbar" content="no" />
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
	<meta name="revisit-after" content="7 days">
	<meta name="Copyright" content="Beverley Morris">
	<meta name="Robots" content="all">
	<meta name="language" content="en">
	<meta name="distribution" content="Global">

	<link rel="shortcut icon" href="/favicon.ico" />
	<link rel="stylesheet" type="text/css" href="css/print.css" media="print" />

	<style type="text/css" media="screen">
	<!--
	@import url(css/styles.css);
	-->
	</style>
	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script> 
	<script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>
 	<script src="js/global.js" type="text/javascript"></script>
	<script src="js/jquery.goomaps.js" type="text/javascript"></script>
	
	
	
	
</head>

<body>

<div id="container_header">
	<div id="header">

	<div id="logo"><h1><a href="/" title="Home"><span></span></a></h1></div>

	<div id="header-right">
	<div id="contact">
	Tel: 020   Fax: 020 <br />
	Email: <a href="mailto:enquiries@.co.uk">enquiries@.co.uk</a>
	</div>
	</div>

	<div id="navigation">
		<ul class="navInner">
			<li><a href="/">Homepage</a></li>
			<li><a href="about-us.htm" >About Us</a></li>
			<li>
				<a href="our-services.htm">Our Services</a>
				<ul>
					
				</ul>
			</li>
			<li>
				<a href="team-profiles.htm" >Team Profiles</a>
				<ul>
					
				</ul>
			</li>

		<li><a href="contact.php" class="active">Contact Us</a></li>
		</ul>
	</div>

	</div>
</div>
	
<div id="container_body">
	<div id="body">
		
		<div class="clearboth">&nbsp;</div>


		<div id="home_panel">

			<div id="home_bottompanel_content">

			<h2>Contact Us</h2>
		
			<div class="goomapsWrapper">
				<h3>Office</h3>
				<p>
					<br />
					<br />
					<span>T:</span> +44 020 <br />
					<span>F:</span> +44 020 <br />
					<span>DX:</span> <br />
					<span>E:</span> <a href="mailto:enquiries@.co.uk">enquiries@.co.uk</a>
					
				</p>	
				<div id="map_canvas" class="map_canvas"></div>	
			</div>
			<div class="goomapsWrapper">
				<h3>Office</h3>
				<p>

					<br />
					<br />
					<span>E:</span> <a href="mailto:.co.uk">.co.uk</a>
				</p>					
				<div id="map_canvas2" class="map_canvas"></div>					
			</div>			

			<div>
			<?php if (!$SENT) { ?>

			<?php if (!$SENT && $_POST) { 
				echo '<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>

			<?php
				} else {
			?>
			<p>Thank you for your enquiry. We will reply as soon as possible.</p>
			<?php
				}
			?>

		</p>

			</div>
		</div>
		
		<div id="ftr">
		<span id="copyright">Copyright &copy; <br />
		Tel: 020 8852 4433 &nbsp;  Fax: 020 8463 9494 &nbsp; Email: <a href="mailto:enquiries@b.co.uk">enquiries@.co.uk</a></span>
		<span id="ftr_links"><a href="terms.htm">Terms of Use</a> <a href="privacy.htm">Privacy Policy</a> <a href="http://www..co.uk" title="Cambridge Web Design and Development by" target="_blank" class="last">Web Design by </a></span>
		<div class="clearboth">&nbsp;</div>
		</div>
		
	</div>

	 <script>
		 $(document).ready(function(){
		 $('#map_canvas').goomaps("init", { 
			center: [51.467434,0.008308],
			zoom: 16,
				clickable: true,
				draggable: true,
				scrollwheel: false,
			OverviewMapControlOptions: false,
		 }).goomaps("addmarkers", [{ options: {
				position: [51.467434,0.008308]

				
				
		 }}]);
		 $('#map_canvas2').goomaps("init", { 
			center: [51.462998,-0.010772],
			zoom: 16,
				clickable: true,
				draggable: true,
				scrollwheel: false,
			OverviewMapControlOptions: false,
		 }).goomaps("addmarkers", [{ options: {
				position: [51.462998,-0.010772]

				
		 }}]);		 
	  });
	 </script>

</body>
</html>

Hi guys, still cannot get this to work is there anything else I can try? The host has confirmed short tags are not supported so I’ve changed all to long tags & used preg_match rather than eregi but I’m still having the same error, - its like nothing I change makes any difference! Whatever I put in the form still returns the same error message & no E-mail is sent.

The host has also said that sending out from the server requires SMTP authentication so I’m wondering if this could be the issue? They have sent me some example scripts of this but I’ve no idea how to implement it into my existing code!?

What else can I do to test this or get it to work?

Thanks

Paste one of the sample scripts here. I’d need to see what they told you to be able to help you update your script.

In the meantime, run this test:

<?php

$SENT = false;
if ($_POST && $_POST["name"] && preg_match("/^[a-zA-Z0-9 ]+$/i", $_POST["name"]) && $_POST["email"] && preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i", $_POST["email"])) {

    $recipient = "test@.co.uk";
    $recipient = "enquiries@.co.uk";
    $subject = "Enquiry from the  Website";
    $email_header = "From: " .$_POST["email"]. " (" .$_POST["name"]. ")\\r\
".
        "Reply-To: " .$_POST["email"]. "";

    // build the email
    $s = "The following contact form has been submitted:\
\
";

    $s .= "=== Customer Details =====\
";
    $s .= "Name: " .$_POST["name"]. "\
";
    $s .= "Company: " .$_POST["company"]. "\
";
    $s .= "Telephone: " .$_POST["telephone"]. "\
";
    $s .= "Email Address: " .$_POST["email"]. "\
\
";

    $s .= "=== Enquiry Information =====\
";
    $s .= trim($_POST["comments"])."\
\
";

    $s.= "Generated: " .date("Y-m-d H:i:s");

    $email = wordwrap($s, 72). "\
\
\
"; // wrap text to 72 characters

    echo "Attempting to send e-mail...";
    if (@mail($recipient, $subject, $email, $email_header)) {
        $SENT = true;
        echo "Success!";
    } else {
        $SENT = false;
        echo "Failed!";
    }
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="imagetoolbar" content="no" />
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name="revisit-after" content="7 days">
    <meta name="Copyright" content="Beverley Morris">
    <meta name="Robots" content="all">
    <meta name="language" content="en">
    <meta name="distribution" content="Global">

    <link rel="shortcut icon" href="/favicon.ico" />
    <link rel="stylesheet" type="text/css" href="css/print.css" media="print" />

    <style type="text/css" media="screen">
    <!--
    @import url(css/styles.css);
    -->
    </style>
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true"></script>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&language=en"></script> 
    <script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>
     <script src="js/global.js" type="text/javascript"></script>
    <script src="js/jquery.goomaps.js" type="text/javascript"></script>
    
    
    
    
</head>

<body>

<div id="container_header">
    <div id="header">

    <div id="logo"><h1><a href="/" title="Home"><span></span></a></h1></div>

    <div id="header-right">
    <div id="contact">
    Tel: 020   Fax: 020 <br />
    Email: <a href="mailto:enquiries@.co.uk">enquiries@.co.uk</a>
    </div>
    </div>

    <div id="navigation">
        <ul class="navInner">
            <li><a href="/">Homepage</a></li>
            <li><a href="about-us.htm" >About Us</a></li>
            <li>
                <a href="our-services.htm">Our Services</a>
                <ul>
                    
                </ul>
            </li>
            <li>
                <a href="team-profiles.htm" >Team Profiles</a>
                <ul>
                    
                </ul>
            </li>

        <li><a href="contact.php" class="active">Contact Us</a></li>
        </ul>
    </div>

    </div>
</div>
    
<div id="container_body">
    <div id="body">
        
        <div class="clearboth">&nbsp;</div>


        <div id="home_panel">

            <div id="home_bottompanel_content">

            <h2>Contact Us</h2>
        
            <div class="goomapsWrapper">
                <h3>Office</h3>
                <p>
                    <br />
                    <br />
                    <span>T:</span> +44 020 <br />
                    <span>F:</span> +44 020 <br />
                    <span>DX:</span> <br />
                    <span>E:</span> <a href="mailto:enquiries@.co.uk">enquiries@.co.uk</a>
                    
                </p>    
                <div id="map_canvas" class="map_canvas"></div>    
            </div>
            <div class="goomapsWrapper">
                <h3>Office</h3>
                <p>

                    <br />
                    <br />
                    <span>E:</span> <a href="mailto:.co.uk">.co.uk</a>
                </p>                    
                <div id="map_canvas2" class="map_canvas"></div>                    
            </div>            

            <div>
            <?php if (!$SENT) { ?>

            <?php if (!$SENT && $_POST) { 
                echo '<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>

            <?php
                } else {
            ?>
            <p>Thank you for your enquiry. We will reply as soon as possible.</p>
            <?php
                }
            ?>

        </p>

            </div>
        </div>
        
        <div id="ftr">
        <span id="copyright">Copyright &copy; <br />
        Tel: 020 8852 4433 &nbsp;  Fax: 020 8463 9494 &nbsp; Email: <a href="mailto:enquiries@b.co.uk">enquiries@.co.uk</a></span>
        <span id="ftr_links"><a href="terms.htm">Terms of Use</a> <a href="privacy.htm">Privacy Policy</a> <a href="http://www..co.uk" title="Cambridge Web Design and Development by" target="_blank" class="last">Web Design by </a></span>
        <div class="clearboth">&nbsp;</div>
        </div>
        
    </div>

     <script>
         $(document).ready(function(){
         $('#map_canvas').goomaps("init", { 
            center: [51.467434,0.008308],
            zoom: 16,
                clickable: true,
                draggable: true,
                scrollwheel: false,
            OverviewMapControlOptions: false,
         }).goomaps("addmarkers", [{ options: {
                position: [51.467434,0.008308]

                
                
         }}]);
         $('#map_canvas2').goomaps("init", { 
            center: [51.462998,-0.010772],
            zoom: 16,
                clickable: true,
                draggable: true,
                scrollwheel: false,
            OverviewMapControlOptions: false,
         }).goomaps("addmarkers", [{ options: {
                position: [51.462998,-0.010772]

                
         }}]);         
      });
     </script>

</body>
</html>

After submitting the form (and if the name and e-mail are provided and valid), you should see “Attempting to send e-mail…” followed by Success! or Failed!. That way we at least know the issue is with sending the email and not your validation.

Then once we have a sample, we can help you update your mail section so it works.