how to update value inside the while loop in php
<p>hi everyone im creating simple posting grade online.
the problem is how i can save all value inside the while loop</p>

<p>here is the code</p>

<pre><code> $sql1 = mysql_query("SELECT * FROM tblsubjecschedule  where  sched_id='".$col."'  ")or die(mysql_error());
 while($val=mysql_fetch_array($sql1)){

    $Subject=$val['Subject'];
 }

 echo "&lt;tr&gt;&lt;td width=''&gt;&lt;font face='Arial' size='3pt'&gt;Subjec Code&lt;/td&gt;&lt;td width=''&gt;&lt;font face='Arial' size='3pt'&gt;".$Subject."&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;
 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Student Name&lt;/td&gt;
 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Course&lt;/td&gt;

 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Prelim&lt;/td&gt;
 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Midterm&lt;/td&gt;
 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Semi&lt;/td&gt;
 &lt;td width=''&gt;&lt;font face='Arial' size=''&gt;Final&lt;/td&gt;
 &lt;/tr&gt;";
      echo "&lt;/thead&gt;
&lt;tfoot&gt;&lt;/tfoot&gt;
&lt;tbody&gt;";


$sql = mysql_query("SELECT * FROM tblstudntsub  where Sublink='".$control."' order by studname ASC")or die(mysql_error());


 $a=0;
 $b=1;
while($row=mysql_fetch_assoc($sql)){
$id=$row['id'];
$name=$row['studname'];
$cor=$row['course'];
$yl=$row['YearLevel'];





    echo"&lt;tr bgcolor='#E6E6E6'&gt;
    &lt;td align='left'&gt;&lt;p align='left'&gt;".$b.".".$name."&lt;/p&gt;&lt;input type='hidden' name='cont[$a]' value=".$id."&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p align='left'&gt;".$cor."&lt;/p&gt;&lt;/td&gt;

    &lt;td&gt; &lt;input type='text' name='pre[$a]' value=''style='width:40px;'&gt;&lt;/td&gt;
    &lt;td&gt; &lt;input type='text' name='mid[$a]' value=''style='width:40px;' &gt;&lt;/td&gt;
    &lt;td&gt; &lt;input type='text' name='semi[$a]' value=''style='width:40px;' &gt;&lt;/td&gt;
    &lt;td&gt; &lt;input type='text' name='fin[$a]' value=''style='width:40px;' &gt;&lt;/td&gt;



    &lt;/tr&gt;"; 
    $a++;
    $b++;
        }

      echo  "   &lt;tr&gt;&lt;td&gt;
    &lt;input type='submit' name='save[$a]' value='Save'/&gt;
 &lt;/td&gt;&lt;/tr&gt;";

echo "&lt;/tbody&gt;&lt;table&gt;";
</code></pre>

<p>sorry for my bad grammar hope you understand what i mean.</p>

<p>THANK YOU IN ADVANCE</p>
