Problem with PHP not working and Extra space in form I can't get rid of

This is my first time doing a form, much less using php. I would appreciate your help on the problems below.
1. in the form when you go to the website there is too much vertical spacing between the form fields.
2.the Message field has script inside that vistors can see.
3. on hitting the submit button it redirects me to a blank page and not the thankyou.html page that I had created.
4. the form doesn't send the email to [email protected]
Website URL: http://stickmancustoms.com/contact.html
<!-- FORM CODE STARTS HERE -->
<?php session_start(); ?>
<?php
if (array_key_exists('submit', $_POST)) {
    // check name field
$name = trim($_POST['name']);
if (empty($name)) {
    $error['name'] = 'Please provide your first name';
elseif ($name == 'Please provide your first name') {
    $error['name'] = '';
$_SESSION['name'] = $_POST['name'];
// check phone field
$phone = trim($_POST['phone']);
if (empty($phone)) {
    $error['phone'] = 'Please provide your last name';
elseif ($phone == 'Please provide your last name') {
    $error['phone'] = '';
$_SESSION['phone'] = $_POST['phone'];
// check email field
$email = trim($_POST['email']);
if (empty($email)) {
    $error['email'] = 'Please enter your email address';
elseif ($email == 'Please enter your email address') {
    $error['email'] = '';
$_SESSION['email'] = $_POST['email'];
// check enquiry field
$message = trim($_POST['message']);
if (empty($message)) {
    $error['message'] = 'Please enter your message details';
elseif ($message == 'Please enter your message details') {
    $error['message'] = '';
$_SESSION['message'] = $_POST['message'];
if (!empty($_POST['ufo'])) { return false; }
// recipient
$to = "[email protected]"; //email address -- change to your own email address
// email subject
$subject = "I am interested in your services, please contact me";
// sender
$sender = "From: ".$_POST['email']."\r\n";
// build message
$enquiry = "First Name: $name\n\n";
$enquiry .= "Last Name: $phone\n\n";
$enquiry .= "Email Address: $email\n\n";
$enquiry .= "Message: $message\n\n";
// send email if no form erorrs
if (!isset($error)) {
mail($to, $subject, $enquiry, $sender);
header("Location: thankyou.html");        //Redirect page -- change to your own page
?>
CONTACT WEB PAGE CODE BELOW
<!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">
<head>
<meta http-equiv="auto repair, accident damage, custom paint, customization, car repair, paint job, hot rod, motorcycle, cycle, bike, chopper"
content="At StickMan Customs we give personal service with a smile. With more than 20 years experience in auto repair and customization you can be confident that we will meet your expectations and beyond. " />
<meta name="google-site-verification" content="-41pB0MQUYT1Vbv1SId8WcU2lqEmFf0u23Sl3NY24CE" />
<title>Stickman Customs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="smc.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:visited {
    color: #F4781E;
-->
</style>
</head>
<body bgcolor="#000000">
<table width="936" height="200" border="0" align="center">
  <tr>
    <td height="196" valign="top"><p class="style1"><a href="index.html" target="_self"><a href="index.html" target="_self"><img src="images/smcbanner.jpg" width="936" height="194" border="0" usemap="#Map" /></a>
        <map name="Map" id="Map">
          <area shape="rect" coords="97,7,289,190" href="index.html" target="_self" />
          <area shape="rect" coords="290,156,380,189" href="about.html" target="_self" />
          <area shape="rect" coords="396,159,550,190" href="repair.html" target="_self" />
          <area shape="rect" coords="561,159,619,190" href="cars.html" target="_self" />
          <area shape="rect" coords="627,159,703,188" href="cycles.html" target="_self" />
          <area shape="rect" coords="711,160,885,190" href="projects.html" target="_self" />
          <area shape="rect" coords="734,23,917,78" href="contact.html" target="_self" />
          <area shape="rect" coords="786,175,787,176" href="#" />
        </map>
      </p>
      <table width="936" border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td width="512" height="450" valign="top"><p class="Headers"><img src="images/car1.jpg" width="432" height="432" /></p></td>
          <td width="389" height="450" valign="top"><form id="enquiryForm" name="enquiryForm" method="post" action="contact.php">
              <h1><span class="BodyBold">Contact Us </span></h1>
              <h1> <span class="BodyCopy">*Required Information </span></h1>
              <h1><span class="BodyBold">
                <label for="Name">Name* </label>
                </span>
                <input type="text" name="name" id="name" <?php if(isset($error['first_name'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($name)) {echo $name;} ?><?php if(isset($error['first_name'])) echo $error['name']; ?>" onfocus="this.value=''" />
              </h1>
              <p>
                <label for="Name" class="BodyBold">Phone* </label>
                <input type="text" name="phone" id="phone" <?php if(isset($error['phone'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($phone)) {echo $phone;} ?><?php if(isset($error['phone'])) echo $error['phone']; ?>" onfocus="this.value=''" />
              <p>
                <label for="email" class="BodyBold">Email* </label>
                <input type="text" name="email" id="email" <?php if(isset($error['email'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($email)) {echo $email;} ?><?php if(isset($error['email'])) echo $error['email']; ?>" onfocus="this.value=''" />
              <p style="padding-bottom: 0;">
                <label for="enquiry" class="BodyBold">Message*</label>
                <br />
                <textarea name="message" id="message" <?php if(isset($error['message'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> onfocus="this.value=''"><?php if(isset($message)) {echo $message;} ?><?php if(isset($error['message'])) echo $error['message']; ?>
          </textarea>
              </p>
              <p>
                <input type="text" name="ufo" style="display: none;" />
                <input type="submit" id="submitButton" name="submit" value="Submit" />
              </p>
</form></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="936" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
        <div align="center" class="bottomlinks">
          <p><a href="about.html" target="_self"><br />
            ABOUT US <img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="repair.html" target="_self">ACCIDENT REPAIR</a><a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="cars.html" target="_self">CARS</a><a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="cycles.html" target="_self">CYCLES</a><a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="projects.html" target="_self">SPECIAL PROJECTS</a></p>
          <p class="Address_Text">StickMan Customs<br />
            800 Mooresville Rd, Kannapolis, NC 28081<br />
            704.699.5110 </p>
        </div>
        <p class="style74"><span class="atb_text">Designed &amp; Hosted by</span><br />
          <a href="http://www.abovethebarrdesign.com" target="_self"><img src="images/atbd.jpg" alt="1" width="155" height="77" border="0" /></a><br />
        </p>
      </div></td>
  </tr>
</table>
</body>
</html>
<!-- text below generated by server. PLEASE REMOVE -->
<!-- Counter/Statistics data collection code -->
<script language="JavaScript" src="http://us.js2.yimg.com/us.js.yimg.com/lib/smb/js/hosting/cp/js_source/whv2_001.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">geovisit();</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<noscript>
<img src="http://visit.webhosting.yahoo.com/visit.gif?us1262644054" alt="setstats" border="0" width="1" height="1" />
</noscript>
</html>

The below should work for you.
As Jon points out the page has to be a .php page NOT a .html page.
The idea is that the page gets sent back to itself and the form information is processed then sent to the email address if there are no errors detected.
The unusual gaps in the form were being caused by unclosed tags amongst other things - hopefuly I put some of it right for you.
Copy all of the below and save it as contact.php - Obviously your server needs to support php for it to work, most do. I have not specified your email address in the php as it attracts spam from the forum so re-instate it where the xxxxxxx are.
<?php
if (array_key_exists('submit', $_POST)) {
// check name field
$name = trim($_POST['name']);
if (empty($name)) {
$error['name'] = 'Please provide your name';
elseif ($name == 'Please provide your name') {
$error['name'] = '';
// check phone field
$phone = trim($_POST['phone']);
if (empty($phone)) {
$error['phone'] = 'Please provide your phone number';
elseif ($phone == 'Please provide your phone number') {
$error['phone'] = '';
// check email field
$email = trim($_POST['email']);
if (empty($email)) {
$error['email'] = 'Please enter your email address';
elseif ($email == 'Please enter your email address') {
$error['email'] = '';
// check enquiry field
$message = trim($_POST['message']);
if (empty($message)) {
$error['message'] = 'Please enter your message details';
elseif ($message == 'Please enter your message details') {
$error['message'] = '';
if (!empty($_POST['ufo'])) { return false; }
// recipient
$to = "xxxxxx@xxxxxxxxxxxxxx"; //email address -- change to your own email address
// email subject
$subject = "I am interested in your services, please contact me";
// sender
$sender = "From: ".$_POST['email']."\r\n";
// build message
$enquiry = "Name: $name\n\n";
$enquiry .= "Phone Number: $phone\n\n";
$enquiry .= "Email Address: $email\n\n";
$enquiry .= "Message: $message\n\n";
// send email if no form erorrs
if (!isset($error)) {
mail($to, $subject, $enquiry, $sender);
header("Location: thankyou.html");  //Redirect page -- change to your own page
?>
<!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">
<head>
<meta http-equiv="auto repair, accident damage, custom paint, customization, car repair, paint job, hot rod, motorcycle, cycle, bike, chopper"
content="At StickMan Customs we give personal service with a smile. With more than 20 years experience in auto repair and customization you can be confident that we will meet your expectations and beyond. " />
<meta name="google-site-verification" content="-41pB0MQUYT1Vbv1SId8WcU2lqEmFf0u23Sl3NY24CE" />
<title>Stickman Customs</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="http://stickmancustoms.com/smc.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:visited {
    color: #F4781E;
-->
</style>
</head>
<body bgcolor="#000000">
<table width="936" height="200" border="0" align="center">
  <tr>
    <td height="196" valign="top"><p class="style1"><a href="index.html" target="_self"><a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/smcbanner.jpg" width="936" height="194" border="0" usemap="#Map" /></a>
        <map name="Map" id="Map">
          <area shape="rect" coords="97,7,289,190" href="index.html" target="_self" />
          <area shape="rect" coords="290,156,380,189" href="about.html" target="_self" />
          <area shape="rect" coords="396,159,550,190" href="repair.html" target="_self" />
          <area shape="rect" coords="561,159,619,190" href="cars.html" target="_self" />
          <area shape="rect" coords="627,159,703,188" href="cycles.html" target="_self" />
          <area shape="rect" coords="711,160,885,190" href="projects.html" target="_self" />
          <area shape="rect" coords="734,23,917,78" href="contact.html" target="_self" />
          <area shape="rect" coords="786,175,787,176" href="#" />
        </map>
      </p>
      <table width="936" border="0" align="center" cellpadding="5" cellspacing="5">
        <tr>
          <td width="512" height="450" valign="top"><p class="Headers"><img src="http://stickmancustoms.com/images/car1.jpg" width="432" height="432" /></p></td>
          <td width="389" height="450" valign="top"><form id="enquiryForm" name="enquiryForm" method="post" action="contact.php">
              <p><span class="BodyBold">Contact Us </span></p>
              <p><span class="BodyCopy">*Required Information</span></p>
              <p>
                <label for="Name" class="BodyBold">Name* </label>
                </span>
                <input type="text" name="name" id="name" <?php if(isset($error['name'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($name)) {echo $name;} ?><?php if(isset($error['name'])) echo $error['name']; ?>" onfocus="this.value=''" />
              </p>
              <p>
                <label for="Name" class="BodyBold">Phone* </label>
                <input type="text" name="phone" id="phone" <?php if(isset($error['phone'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($phone)) {echo $phone;} ?><?php if(isset($error['phone'])) echo $error['phone']; ?>" onfocus="this.value=''" />
              </p>
              <p>
                <label for="email" class="BodyBold">Email* </label>
                <input type="text" name="email" id="email" <?php if(isset($error['email'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> value="<?php if(isset($email)) {echo $email;} ?><?php if(isset($error['email'])) echo $error['email']; ?>" onfocus="this.value=''" />
                </p>
              <p>
                <label for="enquiry" class="BodyBold">Message*</label>
                <textarea name="message" id="message" <?php if(isset($error['message'])) echo "style='border: 1px solid #C00; color: #C00;'"; ?> onfocus="this.value=''"><?php if(isset($message)) {echo $message;} ?><?php if(isset($error['message'])) echo $error['message']; ?>
          </textarea>
              </p>
              <p>
                <input type="text" name="ufo" style="display: none;" />
                <input type="submit" id="submitButton" name="submit" value="Submit" />
              </p>
</form></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="936" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
        <div align="center" class="bottomlinks">
          <p><a href="about.html" target="_self">
            ABOUT US <img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="repair.html" target="_self">ACCIDENT REPAIR</a><a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="cars.html" target="_self">CARS</a><a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="cycles.html" target="_self">CYCLES</a><a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a>| <a href="index.html" target="_self"><img src="http://stickmancustoms.com/images/space.jpg" alt="s" width="18" height="7" border="0" /></a><a href="projects.html" target="_self">SPECIAL PROJECTS</a></p>
          <p class="Address_Text">StickMan Customs<br />
            800 Mooresville Rd, Kannapolis, NC 28081<br />
            704.699.5110 </p>
        </div>
        <p class="style74"><span class="atb_text">Designed &amp; Hosted by</span><br />
          <a href="http://www.abovethebarrdesign.com" target="_self"><img src="http://stickmancustoms.com/images/atbd.jpg" alt="1" width="155" height="77" border="0" /></a><br />
        </p>
      </div></td>
  </tr>
</table>
</body>
</html>
<!-- text below generated by server. PLEASE REMOVE -->
<!-- Counter/Statistics data collection code -->
<script language="JavaScript" src="http://us.js2.yimg.com/us.js.yimg.com/lib/smb/js/hosting/cp/js_source/whv2_001.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">geovisit();</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<noscript>
<img src="http://visit.webhosting.yahoo.com/visit.gif?us1262644054" alt="setstats" border="0" width="1" height="1" />
</noscript>
</html>

Similar Messages

Maybe you are looking for