我已经从 mysql 中选择了数据并将它们插入到一个单选按钮表单中,如图所示:
if($num_rows) {
echo '<form name="fixtureform" method="POST" action="index.php">';
while ($row = mysql_fetch_assoc($result)) {
echo $row["home_team"] . " vs " . $row["away_team"]. '<br />' . " Home" . '<input type="radio" name="win'.$row["home_id"].'" value="'.$row["home_id"].'"/>' ." Draw" . '<input type="radio" name="'.$row["home_id"].$row["away_id"].'" value="draw"/>' ." Away" . '<input type="radio" name="win'.$row["away_id"].'" value="' . $row["away_id"] . '"/>' .'<br />';
}
echo '<input type="Submit" Name="Submitacc" Value="Submit your teams">';
echo '</form>';
} else {
echo "There are no fixtures today ";
}
然后我有一个提交值的 if 语句:
if($_POST['Submitacc']=='Submit your teams') {
}
如果单选按钮的选定名称是 win.$row[home_id],我该怎么说 - 将值插入 mysql 表。我正在努力解决我无法在循环之外获得 $row[home_id] 的事实?
提前致谢