目前我有一个下拉菜单循环(循环取决于我可以定义的每页结果,你可以看到我为什么要使用循环),我想把下拉菜单变成单选按钮。下面是我的代码。你能给我一些关于如何转换它的指示吗?
if (isset($_POST['formSubmit'])){
$rating = $_POST['rating'];
$accountID = $_POST['accountID'];
$query = mysql_query("UPDATE Spreadsheet SET rating='$rating' WHERE accountID='$accountID'");
}
while ($row = mysql_fetch_array($query)){
?>
<form name ="rating" method ="POST" action ="" > <?
echo "<input type = 'hidden' name = 'accountID' value = '" . $row['accountID'] . "' >";
?>
<select name="rating">
<?
$values = array('0 - No rating','1 - Very Bad','2 - Bad','3 - Average','4 - Above Average');
for ($i =0; $i < count($values); $i++){
echo "<option value = \"$i\"";
if ($row['rating'] == $i) {
echo "selected=\"selected\"";
}
echo ">" . $values[$i] . "</option>";
}
?>
</select>
<input type ="Submit" name ="formSubmit" value ="Submit" />
</form>