Submit enquiry form with PHP file
<p>I'm new at this, could someone have a look at my sendresults script and tell me where I have gone wrong? </p>

<p>The form is a seperate HTML doc, the .php is uploaded to root directory, I have a confirm and error.html in the root too. The form when submitted comes back up blank. 
Here is the script;(I have taken out the complete business website urls)</p>

<pre><code>&lt;?php

// Subject 
$subject = "Results from Enquiry form";
//  form information will be sent to.
$mailto = 'my email';
//form url
$formurl = "http://www....";
// redirect after form is processed.
$confirmurl = 'http://www.....';
//redirect for errors
$errorurl = "http://www....";

$email_is_required =1;
$name_is_required =1;
$comments_is_required = 1;
$telephone_is_required = 1;
$uself = 0;
$forcelf = 0;
$use_envsender = 0;
$use_sendmailfrom = 0;
$smtp_server_win = "";
$use_webmaster_email_for_from = 0;
$use_utf8 = 1;

define ('MAX_LINE_LENGTH', 900 );
$headersep = $uself ? "\n":"\r\n";
$content_nl = $forcelf ? "\n" : (defined('PHP_EOL') ? PHP_EOL : "\n");
$content_type = $use_utf8 ? 'Content-Type: text/plain; charset="utf-8"' : 'Content-Type: text/plain; charset="iso-8859-1"';
if ($use_sendmailfrom) {
    ini_set('sendmail_from', $mailto);
}

$envsender = "-f$mailto";
$name = isset($_POST['name']) ?
    $_POST['name']: $_POST['name'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $state = $_POST['state'];
    $postcode = $_POST['postcode'];
    $telephone = $_POST['telephone'];
    $email = $_POST['email'];
    $comments = $_POST['comments'];  
    $bushwalking = $_POST['bushwalking'];
    $trout_fishing = $_POST['trout_fishing'];
    $canoeing = $_POST['canoeing'];
    $accommodation = $_POST['accommodation'];
    $corporate_events = $_POST['corporate_events'];
    $guests_for_accomm = $_POST['guests_for_accomm'];
    $stay = $_POST['stay'];
    $dday = $_POST['dday'];
    $dMonth = $_POST['dMonth'];
    $dYear = $_POST['dYear'];
    $http_referrer = getenv ("HTTP_REFERER" );

if (!isset($_POST['email']))  {
    header("Location: $formurl" );
    exit;
}
if (($email_is_required &amp;&amp; (empty($email) || !preg_match('/@/', $email))) || ($name_is_required &amp;&amp; empty($name)) || ($comments_is_required &amp;&amp; empty($comments))) {
           header("Location: $errorurl" );
           exit;
}
if ( preg_match("/[\r\n]/", $name) || preg_match ("/[\r\n]/", $email) ) {header( "Location: $errorurl" );
exit;
}
if (empty($email)) {
    $email = $mailto ;
}
$fromemail = $use_webmaster_email_for_from ? $mailto : $email;
if (function_exists('get_magic_quotes_gpc' ) &amp;&amp; get_magic_quotes_gpc()) {
    $comments = stripslashes ($comments);
}
$messageproper = "Ths message was sent from:" . $content_nl . 
                 "http_referer" . $content_nl .
                 "-----------------------------------------------------------------
                 " . $content_nl .
                 "Name of sender: $name" . $content_nl .
                 "Address of sender: $address" . $content_nl .
                 "City of sender: $city" . $content_nl .
                 "State of sender: $state" . $content_nl .
                 "Postcode of sender: $postcode" . $content_nl .
                 "Telephone of sender: $telephone" . $content_nl .
                 "Email of sender: $email" . $content_nl .
                 "Required information: $bushwalking, $trout_fishing, $canoeing, $accommodation, $corporate_events " . $content_nl .
                 "Number of guest: $guests_for_accomm" . $content_nl . 
                 "Length of stay: $stay" . $content_nl .
                 "Date if arrival: $dday, dMonth, dYear" . $content_nl . 
                 "-------------------------------------------COMMENTS--------------------------------------" . $content_nl . $contents_nl . 
                 wordwrap($comments, MAX_LINE_LENGTH, $content_nl, true ) . $content_nl . $content_nl . "---------------------------------------------------------------------------------------------------------" . $content_nl ;
                 $headers = "From:\"$name\" &lt;$fromemail&gt;" . 
                 $headersep . "Reply-To:\"$name\"&lt;$email&gt;" .
                 $headersep . "X-Mailer: chfeedback.php 2.16.2" . 
                 $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ;
if ($use_envsender) {
         if(mail($mailto, $subject, $messageproper, $headers, $envsender))
         {
          echo("Location: $confirmurl");
}}
else  {
          echo( "Location: $errorurl" );   
}
?&gt;

Here is the html
&lt;body&gt;
&lt;div id="apDiv1"&gt;
&lt;div class="form"&gt;&lt;form id="enquiry_form" name="enquiry_form" method="post" action="/sendresults.php" enctype="text/plain" onsubmit="return exec()"&gt;
  &lt;table width= "420" border="0" cellpadding="0" cellspacing="5"&gt;
   &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt;
    &lt;tr&gt;
      &lt;th colspan="2"&gt;Please enter details for your enquiry below&lt;br/&gt;&lt;br/&gt;
        &lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width="25%" align="left"&gt;
         Name:&lt;/td&gt;
          &lt;td width="75%"&gt;&lt;label&gt;&lt;input name="name" type="text" class="content_fieldset" id="name" value=""/&gt;*
          &lt;/label&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;
         &lt;td&gt;Address:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="address" id="address" type="text" class="content_fieldset" value="" /&gt;&lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
       &lt;tr&gt;&lt;td&gt;City:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="city" id="city" type="text" class="content_fieldset" value="" /&gt;&lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;State:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="state" id="state" type="text" class="content_fieldset" value="" /&gt;&lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;tr&gt;&lt;td&gt;Postcode:&lt;/td&gt;
       &lt;td&gt;&lt;label&gt;&lt;input name="postcode" id="postcode" type="text" class="content_fieldset" value="" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Telephone:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="telephone" type="text" class="content_fieldset" id="telephone" value="" /&gt;*&lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
     &lt;tr&gt;&lt;td&gt;E-mail:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="email" type="text" class="content_fieldset" id="email" value=""/&gt;*&lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td colspan="2" align="right"&gt;* Required fields&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt;&lt;/tr&gt; 
           &lt;tr&gt;&lt;td colspan="2"&gt; What would you like information about?&lt;/td&gt;
           &lt;/tr&gt;
         &lt;tr&gt;&lt;td height="10" colspan="2"&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;&lt;td width=10%&gt;&lt;label&gt;&lt;input type="checkbox" name="bushwalking" id="bushwalking" value="bushwalking" checked="checked" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;Bush walking&lt;/td&gt;         &lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;label&gt;&lt;input type="checkbox" name="trout_fishing" id="trout_fishing" value="trout_fishing" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;Trout Fishing&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;label&gt;&lt;input type="checkbox" name="canoeing" id="canoeing" value="canoeing" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;Canoeing&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;label&gt;&lt;input type="checkbox" name="corporate_events" id="corporate_events" value="corporate_events" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;Corporate Events&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;&lt;label&gt;&lt;input type="checkbox" name="accommodation" id="accommodation" value="accommodation" checked="checked" /&gt;&lt;/label&gt;&lt;/td&gt;&lt;td&gt;Accommodation&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td height="20" colspan="2"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td width="40%"&gt;No. of Guests requiring accommodation:&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;&lt;input name="guests_for_accomm" type="text" id="guests_for_accomm" size="3" value="" /&gt;&lt;/label&gt;&lt;/td&gt;
          &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt; 
          &lt;/tr&gt;
          &lt;tr&gt;&lt;td&gt;Length of Stay:&lt;/td&gt;&lt;td&gt;&lt;label&gt;
          &lt;select name="stay" id="stay"&gt;
            &lt;option&gt;0 nights&lt;/option&gt;
            &lt;option&gt;1 night&lt;/option&gt;
            &lt;option&gt;2 nights&lt;/option&gt;
            &lt;option&gt;3 nights&lt;/option&gt;
            &lt;option&gt;4 nights&lt;/option&gt;
            &lt;option&gt;5 nights&lt;/option&gt;
            &lt;option&gt;6 nights&lt;/option&gt;
            &lt;option&gt;7 nights&lt;/option&gt;
            &lt;option&gt;8 nights&lt;/option&gt;
            &lt;option&gt;9 nights&lt;/option&gt;
            &lt;option&gt;10 nights&lt;/option&gt;
          &lt;/select&gt;
          &lt;/label&gt;&lt;/td&gt;
          &lt;/tr&gt;
           &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt;
          &lt;tr&gt;&lt;td width="35%"&gt;Date of Arrival:&lt;/td&gt;
          &lt;td&gt;&lt;select name="dday" id="dday"&gt;
            &lt;option value="01" &gt;1&lt;/option&gt;
            &lt;option value="02" &gt;2&lt;/option&gt;
            &lt;option value="03" &gt;3&lt;/option&gt;
            &lt;option value="04" &gt;4&lt;/option&gt;
            &lt;option value="05" &gt;5&lt;/option&gt;
            &lt;option value="06" &gt;6&lt;/option&gt;
            &lt;option value="07" &gt;7&lt;/option&gt;
            &lt;option value="08" &gt;8&lt;/option&gt;
            &lt;option value="09" &gt;9&lt;/option&gt;
            &lt;option value="10" &gt;10&lt;/option&gt;
            &lt;option value="11" &gt;11&lt;/option&gt;
            &lt;option value="12" &gt;12&lt;/option&gt;
            &lt;option value="13" &gt;13&lt;/option&gt;
            &lt;option value="14" &gt;14&lt;/option&gt;
            &lt;option value="15" &gt;15&lt;/option&gt;
            &lt;option value="16" &gt;16&lt;/option&gt;
            &lt;option value="17" &gt;17&lt;/option&gt;
            &lt;option value="18" &gt;18&lt;/option&gt;
            &lt;option value="19" &gt;19&lt;/option&gt;
            &lt;option value="20" &gt;20&lt;/option&gt;
            &lt;option value="21" &gt;21&lt;/option&gt;
            &lt;option value="22" &gt;22&lt;/option&gt;
            &lt;option value="23" &gt;23&lt;/option&gt;
            &lt;option value="24" &gt;24&lt;/option&gt;
            &lt;option value="25" &gt;25&lt;/option&gt;
            &lt;option value="26" &gt;26&lt;/option&gt;
            &lt;option value="27" &gt;27&lt;/option&gt;
            &lt;option value="28" &gt;28&lt;/option&gt;
            &lt;option value="29" &gt;29&lt;/option&gt;
            &lt;option value="30" &gt;30&lt;/option&gt;
            &lt;option value="31" &gt;31&lt;/option&gt;
          &lt;/select&gt;
          &lt;select name="dMonth" id="dMonth"&gt;
            &lt;option value="01" &gt;January&lt;/option&gt;
            &lt;option value="02" &gt;February&lt;/option&gt;
            &lt;option value="03" &gt;March&lt;/option&gt;
            &lt;option value="04" &gt;April&lt;/option&gt;
            &lt;option value="05" &gt;May&lt;/option&gt;
            &lt;option value="06" &gt;June&lt;/option&gt;
            &lt;option value="07" &gt;July&lt;/option&gt;
            &lt;option value="08" &gt;August&lt;/option&gt;
            &lt;option value="09" &gt;September&lt;/option&gt;
            &lt;option value="10" &gt;October&lt;/option&gt;
            &lt;option value="11" &gt;November&lt;/option&gt;
            &lt;option value="12" &gt;December&lt;/option&gt;
          &lt;/select&gt;
          &lt;select name="dYear" id="dYear"&gt;
            &lt;option value="2012" &gt;2013&lt;/option&gt;
            &lt;option value="2013" &gt;2014&lt;/option&gt;
            &lt;option value="2014" &gt;2015&lt;/option&gt;
            &lt;option value="2015" &gt;2016&lt;/option&gt;
            &lt;option value="2016" &gt;2017&lt;/option&gt;
            &lt;option value="2017" &gt;2018&lt;/option&gt;
          &lt;/select&gt;&lt;/td&gt;
          &lt;/tr&gt;
       &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt;
          &lt;tr&gt;&lt;td&gt;Comments:&lt;/td&gt;
          &lt;td&gt;&lt;textarea name="comments" rows="6" cols="30" id="comments" &gt;&lt;/textarea&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;&lt;td height="15" colspan="2"&gt;&lt;/td&gt; 
          &lt;tr&gt;&lt;td colspan="2"&gt;&lt;label&gt;&lt;input name="submit" type="submit" class="button" id="submit" value="Submit"/&gt; 
           &lt;input type="reset" value="Reset"/&gt;&lt;/label&gt;&lt;/td&gt;
        &lt;/tr&gt; 
  &lt;/table&gt;
&lt;/form&gt;&lt;/div&gt;&lt;/div&gt;
</code></pre>
