title: Input type text with array
body: <p>Here is what i'm doing so far. I'm printing with AJAX some checkboxes and some text inputs.
  1 checkbox and 1 input text for each plauer (from a DB).</p>
  
  <p>Problem is when i submit the data to another php file i only see both for certain cases.
  Below is the code i'll explain more.</p>
  
  <p>PHP called by AJAX</p>
  
  <pre><code>if($_GET['function']=="chkplayers")
  {
       $sql=mysql_query("SELECT * FROM tbl_Player ORDER BY team_name")
       or die(mysql_error());
       $i = 1;
          echo'Players : ';
          echo '&lt;br&gt;';
       while ($row = mysql_fetch_array($sql)) {
          echo '&lt;input type="checkbox" name="chk_player[]" value="'.$row['player_id'].'" /&gt; '.$row['player_name'].' in team '.$row['team_name'];
          echo '&lt;input type="text" name="chk_target[]" placeholder="Target Name"/&gt;&lt;br/&gt;';
      $i++;
    }
  
  }
  </code></pre>
  
  <p>PHP called on submit</p>
  
  <pre><code>if (isset($_POST['chk_player']) &amp;&amp; isset($_POST['chk_player'])) {
      $optionArray = $_POST['chk_player'];
      $optionArrayTarget = $_POST['chk_target'];
      for ($i=0; $i&lt;count($optionArray); $i++) {
          echo "i :";
          echo $i;
          echo "Player : ";
          echo $optionArray[$i];
          echo "Target : ";
          echo $optionArrayTarget[$i];
          echo '&lt;br&gt;';
  
      }
  }
  </code></pre>
  
  <p>If i check every box in a row (not leave empty checkboxes in between) it shows up fine.</p>
  
  <p>Example:</p>
  
  <pre><code>i :0Player : 15Target : A1
  i :1Player : 18Target : A2
  i :2Player : 14Target : A3
  </code></pre>
  
  <p>If i leave a box unchecked and then check some more i get this</p>
  
  <pre><code>i :0Player : 15Target : A2
  i :1Player : 16Target : 
  </code></pre>
  
  <p>Anyway way i can fix this?</p>
  
  <p>If i look for $optionArrayTarget i get</p>
  
  <pre><code>i :0Player : 15Target : A1
  i :1Player : 14Target :
  i :2Player : 12Target : A2
  i :3Player : 13Target :
  i :4Player : Target : A3
  i :5Player : Target : A4
  i :6Player : Target :
  i :7Player : Target : 
  </code></pre>