title: Insert data from multiple array form inputs using php and mysql
body: <p>i have three fields</p>
  
  <pre><code>&lt;textarea rows="2" name="answer[]" &gt;&lt;/textarea&gt;
  &lt;select name="fraction[]"&gt;...
  &lt;textarea rows="2" name="feedback[]"&gt;&lt;/textarea&gt;
  </code></pre>
  
  <p>the user should fill this fields more than one time at least four times
  then i use php to loop through this fields to insert it in database</p>
  
  <pre><code>$answer = isset($_POST['answer']) ? $_POST['answer'] : "" ;
  $fraction = isset($_POST['fraction']) ? $_POST['fraction'] : "" ;
  $feedback = isset($_POST['feedback']) ? $_POST['feedback'] : "" ;
  
  foreach($answer as $key=&gt;$value){
      $answer = $value;
      $fraction = $fraction[$key];
      $feedback = $feedback[$key];
      $query = "insert into `question_answer` ( answer, fraction, feedback) values ('$answer', '$fraction','$feedback')";
      $questions-&gt;insertData($query,$con);
  }
  </code></pre>
  
  <p>this insert number of records , the first record  contain all values as i want but the other records only contain the value of the field related to the array i loop through and the other fields are empty..any help ??</p>