title: PHP/HTML form processing
body: <p>The assignment is to create an html form where the user enters the required information, and process the form data via PHP to display the output using $_post method. I can't seem to get the output right, it just basically displays the php code that I wrote. any insight is greatly appreciated
   Note: The html code is lengthy, but I'm sure it's correct. My problem is with the PHP(next) code.
  the following is the output:</p>
  
  <pre><code>0){ $Name = trim($_POST['name']); $adr = trim($_POST['address']); $City = trim($_POST['city']); $state = trim($_POST['state']); $zip = trim($_POST['zip']); $phone = trim($_POST['phone']); $email = trim($_POST['email']); $err = array(); if($Name == ''){ $err[] = "Please enter your name"; } if($adr == ''){ $err[] = "Please enter your address"; } if($City == ''){ $err[] = "Please enter your city"; } if($state == ''){ $err[] = "Please enter your State"; } if($zip == ''){ $err[] = "Please enter your zip"; } if($phone == ''){ $err[] = "Please enter your phone number"; } if($email == ''){ $err[] = "Please enter your email"; } if(count($err) &gt; 0){ foreach($err as $value){ echo"$value
  "; } echo " Go Back"; } else{ //header("Location:HTMLform.html"); echo "Name: " . $_POST["name"]; echo "Address: " . $_POST["address"] ; echo "City: " . $_POST["city"] ; echo "State: " . $_POST["state"]; echo "Zip: " . $_POST["zip"]; echo "Phone: " . $_POST["phone"]; echo "Email: " . $_POST["email"]; } } ?&gt; 
  </code></pre>
  
  <p><strong>page 1 (HTML FORM)</strong></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
   &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt;
   &lt;head&gt;
    &lt;title&gt;Coffee Order&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt;&lt;h1&gt;The Coffee House&lt;/h1&gt;
  
  
  &lt;div&gt;
      &lt;div&gt;&lt;h3&gt;Order Form&lt;/h3&gt;&lt;/div&gt;
      &lt;form name='frmInput' action="process.php" method="post"&gt;
      &lt;table&gt;&lt;tr&gt;&lt;td&gt;Coffee:&lt;/td&gt;
          &lt;td&gt;&lt;select name="coffeeCode" id="Coffee"&gt;
  &lt;option value=""&gt;Select Coffee:&lt;/option&gt;&lt;option value="bv"&gt;Boca Villa ($7.99/lb) 
  &lt;/option&gt;
  &lt;option value="sbr"&gt;South Beach Rhythm ($8.99/lb)&lt;/option&gt;
  &lt;option value="pp"&gt;Pumpkin Paradise ($8.99/lb)&lt;/option&gt;
  &lt;option value="ss"&gt;Sumatran Sunset ($9.99/lb)&lt;/option&gt;
  &lt;option value="bb"&gt;Bali Batur ($10.95/lb)&lt;/option&gt;
  &lt;option value="dd"&gt;Double Dark ($9.95/lb)&lt;/option&gt;&lt;/select&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;
          Type:&lt;/td&gt;
          &lt;td&gt;
  &lt;input type="radio" name="coffeeType" value="caf"&gt;Regular&lt;br/&gt;
  &lt;input type="radio" name="coffeeType" value="decaf"&gt;Decaffeinated
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Quantity (in pounds):&lt;/td&gt;
          &lt;td&gt;
      &lt;input type="text" name="quantity" maxlength="3" size="3" id="Quantity"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Name:&lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" name="name" id="Name"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;E-mail address:&lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" name="email" id="Email"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Telephone #:&lt;/td&gt;
          &lt;td&gt;
      &lt;input type="text" name="phone" maxlength="14" size="14" id="Telephone"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Address:&lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" name="address" id="Address"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;City:&lt;/td&gt;
          &lt;td&gt;
              &lt;input type="text" name="city" id="City"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;State:&lt;/td&gt;
          &lt;td&gt;
  &lt;input type="text" name="state" maxlength="2" size="2" 
  style="text-transform: uppercase" id="State"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
           &lt;td&gt;Zip:&lt;/td&gt;
          &lt;td&gt;
  &lt;input type="text" name="zip" maxlength="10" size="10" id="Zip"&gt;
           &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
  &lt;td&gt;&lt;input type="submit" value="Submit"&gt;&lt;/td&gt;&lt;td&gt;&lt;input    type="reset"&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;&lt;/div&gt;&lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>php code:</p>
  
  <pre><code>&lt;?php
  if (count($_POST) &gt; 0){
  
  $Name = trim($_POST['name']);
  $adr = trim($_POST['address']);
  $City = trim($_POST['city']);
  $state = trim($_POST['state']);
  $zip = trim($_POST['zip']);
  $phone = trim($_POST['phone']);
  $email = trim($_POST['email']);
  $err = array();
  
  if($Name == ''){
  $err[] = "Please enter your name";
  }
  if($adr == ''){
  $err[] = "Please enter your address";
  }
  if($City == ''){
  $err[] = "Please enter your city";
  }
  if($state == ''){
  $err[] = "Please enter your State";
  }
  if($zip == ''){
  $err[] = "Please enter your zip";
  }
  if($phone == ''){
  $err[] = "Please enter your phone number";
  }
  if($email == ''){
  $err[] = "Please enter your email";
  }
  
  if(count($err) &gt; 0){
     foreach($err as $value){
     echo"$value&lt;br/&gt;";
  }
  echo "&lt;a href='HTMLform.html'&gt; Go Back&lt;/a&gt;";
  }
   else{
  //header("Location:HTMLform.html");
   echo "Name: " . $_POST["name"];
  
   echo "Address: " . $_POST["address"] ;
  
   echo "City: " . $_POST["city"] ;
  
   echo "State: " . $_POST["state"];
  
   echo "Zip: " . $_POST["zip"];
  
   echo "Phone: " . $_POST["phone"];
  
   echo "Email: " . $_POST["email"];
   }
  
  }
   ?&gt;
  </code></pre>