我正在尝试设置一个投票过程,其中有20组两个单选按钮,您可以从中进行选择。然后当点击一个“投票”按钮时,我可以收集所选按钮的值并将+1加到它们各自的数据库单元格中。使用单选按钮增加MySql数据库中的值
我新的MySQL和我在努力...
数据库表的样子..
ID Park Votes
1 Zion 0
2 Grand Canyon 0
3 Arches 0
4 Canyonlands 0
5 Yosemite 0
6 Yellowstone 0
HTML表单
<form action="/databases/save.php" method="post">
<input type="radio" name="match1" value="1" />Zion
<input type="radio" name="match1" value="1" />Grand Canyon
<input type="radio" name="match2" value="1" />Arches
<input type="radio" name="match2" value="1" />Canyonlands
<input type="radio" name="match3" value="1" />Yosemite
<input type="radio" name="match3" value="1" />Yellowstone
<input type="image" src="/graphics/logo.png" />
</form>
而且save.php文件
<?php
if (isset($_POST['match1'])){
$match1 = $_POST['match1'];
mysql_query("INSERT INTO results() VALUES ('1')");
}
?>
如何获得选定的收音机并将+1应用于正确的表格单元,我就会被抛弃。在此先感谢
你的回答比较完整和准确。我会撤回我的。 – mseifert