I am populating a table with information from a database, one of the values is a rating 1, 2, 3, or 4. I made it so that depending on the value in the database the radio button with the corresponding value is selected. But I am having problems figuring out how I can update the database when the radio button is changed to a new value. It doesn't have to be changed on click, it can be changed with a submit button after they have made all of the changes they would like to make.
I am fairly new to PHP so I appoligize in advanced if the code is a bit messy. But below is the code I used to populate the table with all of the appropriate values.
while($row2=mssql_fetch_array($SQLresult))
{
//find the competency level
$complevel = $row2[CompetencyLevel];
if($complevel=="1") $a="checked";
if($complevel=="2") $b="checked";
if($complevel=="3") $c="checked";
if($complevel=="4") $d="checked";
//build the table
echo "<tr class=\"\"><td>".$row2[CompetencyID]."</td><td>".$row2[CompetencyName]."</td>";
echo "<td class=\"lft\"><input type=\"radio\" name=\"".$groupnum."\" value=\"1\"".$a."> 1";
echo "<input type=\"radio\" name=\"".$groupnum."\" value=\"2\"".$b."> 2";
echo "<input type=\"radio\" name=\"".$groupnum."\" value=\"3\"".$c."> 3";
echo "<input type=\"radio\" name=\"".$groupnum."\" value=\"4\"".$d."> 4</td></tr>";
//increment the group number
$groupnum++;
//clear the variables
$a="";
$b="";
$c="";
$d="";
}