title: Ajax - Notice: Undefined index: id
body: <p>I'm learning all this php and script things, but I'm having problems with sending the information to the php. I hope you can help me. Thank you. This is the problem: </p>
  
  <blockquote>
    <p>Notice: Undefined index: id in ** on line 103</p>
  </blockquote>
  
  <p>Php:</p>
  
  <pre><code>&lt;?php 
  echo $_POST['id']; //&lt;&lt; This is line 103
  $sql = "SELECT id as ids,position FROM workerPosition WHERE '".$_POST['id']."'=id";
  $rs = mysql_query($sql) or die(mysql_error());
  $row = mysql_fetch_array($rs);
  echo "Codigo:  &lt;input type='text' name='ids' value='".$row['ids']."' disabled&gt;&lt;/br&gt;";
  echo "Nombre:  &lt;input type='text' required='required' name='position'  placeholder='Max 50 caracteres' maxlength='50' value='".$row['position']."'&gt;"; ?&gt;
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>$(document).ready(function() {
      $(".edit-position").click(function () {
          var id = $(this).attr('id') 
  
  
          $.ajax({
          type: "POST",
          data: {id:id},
          url: "editPosition.php",
          }).done(function( data ) {
              location.href = "editPosition.php"
          });
      });
  }); 
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>while($row = mysql_fetch_array($result))
  {
  echo "&lt;tr id='". $row['id'] ."'&gt;";
  echo "&lt;td&gt;" . $row['position'] . "&lt;/td&gt;";
  echo "&lt;td class='buto' id='". $row['id'] ."'&gt; &lt;input type='submit' class='edit-position' id='". $row['id'] ."' value='Edit' /&gt;&lt;/td&gt;";
  echo "&lt;/tr&gt;";
   }
  </code></pre>