title: Whenever I am using a php variable as index on $_POST, isset() doesn't return true even if the index exist
body: <p>Let's say I have a php variable <code>$post_index = 'myInput'</code>. </p>
  
  <p>Assuming that <code>&lt;input name="myInput"&gt;</code> exist, I then use this php variable on <code>$_POST[$post_index]</code>. </p>
  
  <p>Whenever I submit the form and get the value from <code>&lt;input name="myInput"&gt;</code> with the same name as the string in <code>$post_index</code> it works but when I use <code>isset()</code> to check if the form has an input with that name, <code>isset($_POST[$post_index])</code>, <code>isset()</code> returns nothing compared to <code>isset($_POST['myInput'])</code> which returns a 1. </p>
  
  <p>The reason why I am trying to get this to work is because I have a while loop that checks if an input field exist on a dynamically increasing number of fields monitored by an incrementing variable.</p>
  
  <pre><code>&lt;?php
    if(isset($_POST['submit-data'])){
      $i = 1;
      $varcheck = 'part_number'.$i;
      echo "&lt;script&gt;alert('".isset($_POST[$varcheck])."');&lt;/script&gt;"; //this shows nothing
      echo "&lt;script&gt;alert('".isset($_POST['part_number1'])."');&lt;/script&gt;"; //this shows "1"
  }
  ?&gt;
  &lt;form action="" method="post"&gt;
    &lt;input name = "part-number1"&gt;
    &lt;button type="submit" name="submit-data" id="submit-data"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Why is this the case and how do I work around this using only php?</p>
  
  <p>Edit: Added the code</p>
  
  <p>Edit: Answered - Typographical Error</p>