title: Process order form with php to send email
body: <p>I have the following code:</p>
  
  <pre><code> &lt;table class="table table-striped" id="itemsTable"&gt;
                  &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;&lt;/th&gt;
                      &lt;th&gt;Item Code&lt;/th&gt;
                      &lt;th&gt;Description&lt;/th&gt;
                      &lt;th&gt;Qty&lt;/th&gt;
                      &lt;th&gt;Price&lt;/th&gt;
                      &lt;th&gt;Total&lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;/thead&gt;
                  &lt;tbody&gt;
                  &lt;tr class="item-row"&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="itemCode[]" value="" class="input-medium" id="itemCode"
                                 tabindex="1"/&gt;
                      &lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="itemDesc[]" value="" class="input-large" id="itemDesc"
                                 readonly="readonly"/&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="itemQty[]" value="" class="input-mini" id="itemQty" tabindex="2"/&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div class="input-prepend input-append"&gt;&lt;span class="add-on"&gt;&amp;#8364;&lt;/span&gt;
                          &lt;input
                                  name="itemPrice[]"
                                  class=" input-small"
                                  id="itemPrice"
                                  type="text"&gt;&lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div class="input-prepend input-append"&gt;&lt;span class="add-on"&gt;&amp;#8364;&lt;/span&gt;&lt;input
                                  name="itemLineTotal[]" class=" input-small" id="itemLineTotal" type="text"
                                  readonly="readonly"&gt;&lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  </code></pre>
  
  <p>What is the best way to process the inputs via php to send the order via email nicley formated into a table?  This is an order form and I need to to simply be sent to an email once complete</p>
  
  <p>Here is my processing code:</p>
  
  <pre><code>&lt;?php 
  $to = $_REQUEST['xxx'] ; 
  $from = $_REQUEST['Email'] ; 
  $name = $_REQUEST['Name'] ; 
  $headers = "From: $from"; 
  $subject = "Web Contact Data"; 
  
  $fields = array(); 
  $fields{"itemCode"} = "Code"; 
  $fields{"itemDesc"} = "Description"; 
  $fields{"itemPrice"} = "Price"; 
  
  $body = "We have received the following information:\n\n"; 
  
  foreach($fields as $a =&gt; $b){
  $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); 
  } 
  
  $headers2 = "From: noreply@example.com"; 
  $subject2 = "Thank you for contacting us"; 
  $autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com";
  
  
   $send = mail($to, $subject, $body); 
   if($send){
  header( "Location:index.php" );
  } else {
      print "We encountered an error sending your mail, please try again"; 
  } 
  ?&gt; 
  </code></pre>
  
  <p>This code is not working please help</p>