Passing data between PHP webpages from a dynamically generated list
<p>I have a PHP code which generates a dynamic list inside a form like the following, note that the list is built dynamically from database:</p>

<pre><code>echo '&lt;form name="List" action="checkList.php" method="post"&gt;';
while($rows=mysqli_fetch_array($sql))
{
echo "&lt;input type='password' name='code' id='code'&gt;";
echo "&lt;input type='hidden' name='SessionID' id='SessionID' value='$rows[0]' /&gt;";
echo "&lt;input type='submit' value='Take Survey'&gt;";
}
</code></pre>

<p>What I need is to POST the data corresponding to the user choice when he clicks on the button for that row to another page.
If we use hyperlinks with query strings there will be no problem as I'll receive the data from the other page using a GET request and the hyperlinks would be static when showed to the user.
Also I need to obtain the user input from a textbox which is only possible with POST request.</p>

<p>Simply from the other page (checkList.php) I need these data for further processing:</p>

<pre><code>$SessionID=$_POST['SessionID'];
$Code=$_POST['code'];
</code></pre>

<p>As I have a while loop that generates the fields, I always receive the last entry form the database and not the one corresponding to the line (row) that the user chosed from the LIST.</p>
