title: Trouble sending email through contact form with php
body: <p>I've never worked with php before and am trying to make my contact form functional with the help of some php code I acquired through google. </p>
  
  <p>First off do I need to link it to my html page somehow (like css/ javascript) or does it work fine if it shares the same folder?</p>
  
  <p>I have modified the names of certain parts to match the names in my html but am unable to get it to work. When I click the submit button I get a page saying...</p>
  
  <pre><code>"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Deadline: "; $Body .= $Dealine; $Body .= "\n"; $Body .= "Interested: "; $Body .= $Interested; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: &lt;$EmailFrom&gt;"); // redirect to success page if ($success){ print ""; } else{ print ""; } ?&gt;
  </code></pre>
  
  <p>The php code is as follows.</p>
  
  <pre><code>&lt;?php
  
  $EmailFrom = "c@c.co.nz";
  $EmailTo = "c@c.co.nz";
  $Subject = "contact-form";
  $Name = Trim(stripslashes($_POST['Name'])); 
  $Company = Trim(stripslashes($_POST['Company'])); 
  $Email = Trim(stripslashes($_POST['Email'])); 
  $Deadline = Trim(stripslashes($_POST['Dealine'])); 
  $Interested = Trim(stripslashes($_POST['Interested'])); 
  $Message = Trim(stripslashes($_POST['Message'])); 
  
  // validation
  $validationOK=true;
  if (!$validationOK) {
  print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=error.htm\"&gt;";
  exit;
  }
  
  // prepare email body text
  $Body = "";
  $Body .= "Name: ";
  $Body .= $Name;
  $Body .= "\n";
  $Body .= "Company: ";
  $Body .= $Company;
  $Body .= "\n";
  $Body .= "Email: ";
  $Body .= $Email;
  $Body .= "\n";
  $Body .= "Deadline: ";
  $Body .= $Dealine;
  $Body .= "\n";
  $Body .= "Interested: ";
  $Body .= $Interested;
  $Body .= "\n";
  $Body .= "Message: ";
  $Body .= $Message;
  $Body .= "\n";
  
  
  // send email 
  $success = mail($EmailTo, $Subject, $Body, "From: &lt;$EmailFrom&gt;");
  
  // redirect to success page 
  if ($success){
  print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=contact-thanks.php\"&gt;";
  }
  else{
  print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=error.htm\"&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>Here is my html</p>
  
  <pre><code>    &lt;div role="form" class="form-wrapper"&gt;
  &lt;form name="contact-f" action="contact-form.php" method="post"&gt;
  &lt;div class="f-width"&gt;
  &lt;div class="f-col-1 f-group-1"&gt;&lt;input type="text" name="Name" class="c-back input-t f-col-1" placeholder="Name" /&gt;&lt;/div&gt;
  &lt;div class="f-col-1 f-group-2"&gt;&lt;input type="email" name="Company" class="c-back input-t f-col-1" placeholder="Company Name" /&gt;&lt;/div&gt;
  &lt;div class="f-col-1 f-group-1"&gt;&lt;input type="text" name="Email" class="c-back input-t f-col-1" placeholder="Email Address" /&gt;&lt;/div&gt;
  &lt;div class="f-col-1 f-group-2"&gt;&lt;select name="Deadline" class="c-back input-t f-col-1"&gt;&lt;option class="opt-f"&gt;Do you have a Deadline?&lt;/option&gt;&lt;option value="Not yet" class="opt-f"&gt;Not yet&lt;/option&gt;&lt;option value="Less than 1 Month" class="opt-f"&gt;Less than 1 Month&lt;/option&gt;&lt;option value="2-3 Months" class="opt-f"&gt;2-3 Months&lt;/option&gt;&lt;option value="3-6 Months" class="opt-f"&gt;3-6 Months&lt;/option&gt;&lt;option value="6+ Months" class="opt-f"&gt;6+ Months&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;
  &lt;div class="f-col-2 f-group-3"&gt;&lt;select name="Interested" class="c-back input-t f-col-2"&gt;&lt;option class="opt-f"&gt;What are you interested in?&lt;/option&gt;&lt;option value="Branding" class="opt-f"&gt;Branding&lt;/option&gt;&lt;option value="Print Design" class="opt-f"&gt;Print Design&lt;/option&gt;&lt;option value="Illustration" class="opt-f"&gt;Illustration&lt;/option&gt;&lt;option value="Website / UI Design" class="opt-f"&gt;Website / UI Design&lt;/option&gt;&lt;option value="Literature" class="opt-f"&gt;Literature&lt;/option&gt;&lt;option value="Video Editing" class="opt-f"&gt;Video Editing&lt;/option&gt;&lt;option value="Other" class="opt-f"&gt;Other&lt;/option&gt;&lt;/select&gt;&lt;/div&gt;
  &lt;div class="f-col-3 f-group-4"&gt;&lt;textarea name="Message" class="c-back input-t message-f f-col-3" placeholder="Describe your project..."&gt;&lt;/textarea&gt;&lt;/div&gt;
  &lt;div class="f-submit f-group-5"&gt;&lt;input type="Submit" name="Submit" value="Send" class="form-btn" /&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;/form&gt;&lt;/div&gt;
  </code></pre>
  
  <p>(And yes I have created the contact-thanks.php file it calls for at the end).</p>