title: PHP - cannot get value from front end form
body: <p>I am having an issue getting a value from a front end form and using it in an update query. Front end form populating a select box which is working fine...</p>
  
  <pre><code> echo "&lt;select&gt;";
   while ($row = $result-&gt;fetch_assoc()) {
         echo "&lt;option name='plot' value=\"PlotNumber\"&gt;" . 
   $row['PlotNumber'] . "&lt;/option&gt;";
   }  
   echo "&lt;/select&gt;";
  </code></pre>
  
  <p>Here is the AJAX call: </p>
  
  <pre><code> $('.update').click(function() {
      $.ajax({
          type: "POST",
          url: '../php/update.php',
          success:function(html){
              document.getElementById("result").innerHTML=html;   
          }  
      });
      return false;
  });
  </code></pre>
  
  <p>Here is the php: </p>
  
  <pre><code>try {
      $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
      $conn-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      $plot = $_POST['plot'];
      $sql = "UPDATE Developments SET Price = 'BOOKED' WHERE PlotNumber='".$plot."'";
      $stmt = $conn-&gt;prepare($sql);
      $stmt-&gt;execute();
      echo " records UPDATED successfully";
  }
  catch(PDOException $e)
  {
      echo $sql . "&lt;br&gt;" . $e-&gt;getMessage();
  }
  </code></pre>
  
  <p>I'm really stumped as to where im going wrong... Can anyone spot a mistake? </p>