title: how can I store multiple select (select2) data in mysql php?
body: <p>I have tried to store the data but I am not getting the proper output.</p>
  <pre><code> for ($i=0; $i &lt; count($_POST[&quot;service_product&quot;]); $i++) 
  { 
  *This count is 3*
  for ($a =0 ; $a &lt; count($_POST[&quot;service_provider&quot;]); $a++)
                {
               *This count is 4*
                //insert query...
                 } 
  
  } 
  
  </code></pre>
  <hr />
  <p>I'm getting this output:</p>
  <h2>1
  2
  4
  10</h2>
  <h2>1
  2
  4
  10</h2>
  <h2>1
  2
  4
  10</h2>
  <h2>This is the desired output:</h2>
  <h2>1
  2</h2>
  <h2>4</h2>
  <h2>10</h2>
  <p>because in
  the first-row  there are two select values.
  the second-row there is only one select value.
  and
  the third row contains only one...
  and so on...<a href="https://i.stack.imgur.com/uLnJ7.png" rel="nofollow noreferrer">this is the image for reference so that you guys can understand well ..may be I have not explained well</a></p>