How to Send Loop value to another page? : <p>I try to send loop variable to another page with url and GET. but $_GET just only print the last value.</p>

<p>This My code now</p>

<pre><code> ...
 //example
 $codereg[0] = 6;
 $codereg[1] = 2;
 $codereg[2] = 67;

if ($option =='sent')
{

   foreach($codereg as $ids) 
   {
   header("location:checkout.php?id=$userId&amp;productIds[]=$ids");
   }

}
</code></pre>

<p>and this my checkout.php</p>

<pre><code> &lt;?php
 $userId= $_GET['id'];
 $code= $_GET['productIds'];

 foreach($code as $test)
 {
 echo $test;
 }
 ?&gt;
</code></pre>

<p>some one help me fix my code or give better solution...</p>
