title: Onchange update database
body: <p>I'm trying to make an page where you can select a value in a dropdown select box. When the selection is made it should update the database using the selected value.
  I use 2 pages one including the html/javascript and one using php.
  Currently when i select something nothing happens.</p>
  
  <p>What am i doing wrong?</p>
  
  <p>test.php</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt; 
      &lt;script&gt;
      function updateDb() {
       $.post("buh.php", $("#form").serialize());
      }
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form id="form"&gt;
      &lt;?php
          include 'Includes/database_connection.php';
          $sql = "select * FROM sims ORDER BY phonenr asc"    ;
          $result = mysql_query($sql,$con);       
          echo "&lt;select id='select' name='select' onChange='updateDb()'&gt;";
          while ($row = mysql_fetch_array($result)) {
              echo "&lt;option value='" . $row['phonenr'] . "'&gt;" . $row['phonenr'] . "&lt;/option&gt;";
          }
          echo "&lt;/select&gt;";
      ?&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>And buh.php</p>
  
  <pre><code>&lt;?php
  include 'Includes/database_connection.php';
  $sql = "select * FROM sims ORDER WHERE phonenr='".mysql_escape_string($_POST["select"])."'"     ;
  $result = mysql_query($sql,$con);
  while ($row = mysql_fetch_array($result)) {
      $id = $row['id'];
      mysql_query("UPDATE pairings SET sim_id='$id' WHERE unit_id='1'")
  or die(mysql_error()); 
  }
  </code></pre>
  
  <p>?></p>