Loop textfield value and submit to database
<pre><code>$as = mysql_query('SELECT u.id,u.username,c.score FROM user u, course c WHERE u.id = c.userid ');
echo '&lt;form action="score.php" method="post"&gt;&lt;table&gt;';
while($row = mysql_fetch_array($as)
{
   $uid = $row['id'];
   $username = $row['username'];
   $score    = $row['score'];
   echo '&lt;tr&gt;&lt;td&gt;'.$username.'&lt;/td&gt;
             &lt;td&gt;&lt;input type="hidden" name="uid" value='.$uid.'&gt;
                 &lt;input type="text" name="score" value='.$score.'&gt;
             &lt;/td&gt;
         &lt;/tr&gt;
}
echo '&lt;tr&gt;&lt;td&gt;&lt;input type="submit" name="submit" value="update"&gt;&lt;/td&gt;&lt;/tr&gt;';
echo '&lt;/table&gt;&lt;/form&gt;';
if($_SERVER['REQUEST_METHOD == 'POST']
{
  $uid = $_POST['uid'];
  $score = $_POST['score'];
  $sql = mysql('UPDATE user SET c.score = '.$score.' WHERE c.userid = '.$uid.'');
}
</code></pre>

<p>course table</p>

<pre><code>userid    score
 4         45%
 3          30%
 5          80%
</code></pre>

<p>It wasn't updating to table. And I tried to echo the variables, It was showing only the last row, but I edited for user 3 Can anyone suggest where I went wrong</p>
