title: PHP and HTML not updating the page with onchange
body: <p>So basically I have a page built with php inline with html. When I select a new option from my dropdown or enter a new value in a text box I need it to change. I had this working when I was echoing all my HTML in php (noobish mistake I know) but now that I attempted to clean it up it seems to have stop working. Also all my database connections are working just fine so Im not sure whats going on. Full code listed below. Thanks for any help at all and please remember I am a bit new to this.</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"&gt;
  
      &lt;title&gt;Megapixel Calculator&lt;/title&gt;
      &lt;meta name="Megapixel Calculator" content=""&gt;
      &lt;meta name="Matthew Stair" content=""&gt;
  
      &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  
      &lt;link rel="stylesheet" href="style.css"&gt;
  &lt;/head&gt;
  &lt;body style="background:#99CCFF;overflow:hidden;"&gt;
  
  &lt;?php
       $host = "localhost";
       $username = "root";
       $pass = "";
       $database = "database_camcalc";
       $conn = mysql_connect($host, $username, $pass) or die (mysql_error());
       mysql_select_db($database, $conn);
  
       $query = "SELECT camera FROM camlist";
  
       $result = mysql_query($query) or die (mysql_error());
  
        if (isset($_POST['cameraDD']))
        {
               $camSelect = $_POST['cameraDD'];
        }else{
               $camSelect = 'SNV-5200';
        }
  
   $horiQuery = mysql_query("SELECT hori FROM camlist WHERE camera = '$camSelect'");
   if (!$horiQuery) {
     die("Failed: " . mysql_error());
   }
   $hori = mysql_fetch_row($horiQuery);
  
   $sensorSize = mysql_query("SELECT sensor_size FROM camlist WHERE camera = '$camSelect'");
   if (!$sensorSize) {
     die("Failed: " . mysql_error());
   }
  
   $sensorQuery = mysql_query("SELECT camlist.width FROM camlist WHERE camlist.camera = '$camSelect'");
   $sensorRow = mysql_fetch_array($sensorQuery);
   $sensorWidth = floatval($sensorRow['width']);
  
   if(isset($_POST['horizontalFOV'])){
     if($_POST['horizontalFOV'] != 0){
       $horiFOV = $_POST['horizontalFOV'];
     }else{
       $horiFOV = 20;
     }
   }else{
    $horiFOV = 20;
   }
  
   if(isset($_POST['distToObj'])){
     if($_POST['distToObj'] != 0){
       $distObj = $_POST['distToObj'];
     }else{
      $distObj = 35;
     }
   }else{
    $distObj = 35;
   }
  
   $lensCalc = ($distObj / $horiFOV) * $sensorWidth;
   $lensCalcFix = number_format($lensCalc);
   $ppfCalc = $hori[0] / $horiFOV;
  ?&gt;
  
        &lt;div style="width:1000px; margin:auto;"&gt;
  
             &lt;div style="width:50%;float:left;"&gt;
                  &lt;div style="float:left; width:100%;"&gt;
                      &lt;?php
                        print("Select Camera: &lt;select name='cameraDD' value='$camSelect' onchange='this.form.submit()'&gt;");
                        while($row = mysql_fetch_assoc($result)) {
                            if($row['camera'] == $camSelect)
                                print("\r\n&lt;option selected='selected' value='{$row['camera']}'&gt;{$row['camera']}&lt;/option&gt;");
                            else
                                print("\r\n&lt;option value='{$row['camera']}'&gt;{$row['camera']}&lt;/option&gt;");
                            }
                      ?&gt;
                      &lt;/select&gt;
                      &lt;/div&gt;
                      &lt;div style="float:left;width:50%;"&gt;
                           Lens Focal Length: &lt;?php print("$lensCalcFix"); ?&gt; MM
                      &lt;/div&gt;
                      &lt;div style="float:left;width:50%;"&gt;
                           &lt;?php
                           print("Horizontal Field of View: &lt;input style='width:50px;' type='text' name='horizontalFOV' value='$horiFOV' onchange='this.form.submit()'&gt;");
                           ?&gt;
                      &lt;/div&gt;
                      &lt;img style="width:100%" src="/images/example.gif" alt="Example of horizontal field of view and distance to object"&gt;
                      &lt;div&gt;
                            &lt;?php
                              print("Distance to Object: &lt;input style='width:50px;' type='text' name='distToObj' value='$distObj' onchange='this.form.submit()'&gt; Feet");
                            ?&gt;
                      &lt;/div&gt;
  
  
             &lt;/div&gt;
  
             &lt;div style="width:40%;float:left;margin-left:10px;"&gt;
                  &lt;div&gt;
                       &lt;?php
                            echo 'Pixels per Foot: ',
                                 round($ppfCalc),
                                 ' PPF';
                       ?&gt;
                  &lt;/div
                  &lt;div&gt;
                       &lt;?php
                          if ($ppfCalc &lt; 19){
                             echo "&lt;p style ='font-weight:bold;'&gt;Level of detail: Too Low&lt;/p&gt;";
                             echo "&lt;img src='images/noimg.gif' alt='Pixel Per Foot Too Low'&gt;";
                          }elseif ($ppfCalc &gt;= 19 and $ppfCalc &lt;=39){
                                  echo "&lt;p style ='font-weight:bold;'&gt;Level of detail: Observation&lt;/p&gt;";
                                  echo "&lt;img src='images/20ppf.gif' alt='Observation Level'&gt;";
                                       }elseif ($ppfCalc &gt;=40 and $ppfCalc &lt;=59){
                                               echo "&lt;p style ='font-weight:bold;'&gt;Level of detail: Forensic Review&lt;/p&gt;";
                                               echo "&lt;img src='images/40ppf.gif' alt='Forensic Review Level'&gt;";
                                                    }elseif ($ppfCalc &gt;=60 and $ppfCalc &lt;=79){
                                                            echo "&lt;p style ='font-weight:bold;'&gt;Level of detail: Identification&lt;/p&gt;";
                                                            echo "&lt;img src='images/75ppf.gif' alt='Identification Level'&gt;";
                                                                 }elseif ($ppfCalc &gt;=80){
                                                                         echo "&lt;p style ='font-weight:bold;'&gt;Level of detail: Fine&lt;/p&gt;";
                                                                         echo "&lt;img src='images/100ppf.gif' alt='Fine Level'&gt;";
                                                                         }
                       ?&gt;
                  &lt;div style="width:300px;"&gt;
                       &lt;p style="text-decoration:underline;font-weight:bold;"&gt;Observation (General Security) = 20 PPF&lt;/p&gt;
                       &lt;p&gt; Allows for recognition of male/female, color of clothes, approximate height, color of skin, etc...&lt;/p&gt;
                       &lt;p style="text-decoration:underline;font-weight:bold;"&gt;Forensic Review (forensic detail)= 40 PPF&lt;/p&gt;
                       &lt;p&gt;Allows for basic identification of forensic details&lt;/p&gt;
                       &lt;p style="text-decoration:underline;font-weight:bold;"&gt;Identification (high detail)= 60 PPF&lt;/p&gt;
                       &lt;p&gt;Allows for  facial recognition, point-of-sale tracking, etc...&lt;/p&gt;
                       &lt;p style="text-decoration:underline;font-weight:bold;"&gt;Fine = 80 PPF&lt;/p&gt;
                       &lt;p&gt;Allows for detailed facial recognition such as license plate number, scars, birth marks, eye color, tattoos, etc...&lt;/p&gt;
                  &lt;/div&gt;
                  &lt;/div&gt;
             &lt;/div&gt;
  
        &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>