我一直在创建一个网站,允许用户对其他用户上传的图片进行评分。我的代码工作得很好。用户会看到图像,一个标记图像的按钮,10个单选按钮来选择他们的评分和一个提交按钮(都在同一个表单中)。PHP RadioButton提交表格
我的问题是,我想删除提交按钮,并在用户单击单选按钮时处理表单。这个问题是标志按钮(图像按钮)也提交表单。我的代码如下:
HTML
<form name="ratebox" action="Box.php?bid=<?php echo $boxId ?>" method="post">
<table style="margin: 0 auto;">
<tr>
<td colspan="2"><img src="img/boxes/<?php echo $boxId ?>.png" title="<?php echo $boxName ?>" height="350" width="350"></td>
</tr>
<tr>
<input
type="image"
name="flag_submit"
src="img/Flag.png"
onmouseover="this.src='img/Flag_Click.png'"
onmouseout="this.src='img/Flag.png'"
height="30"
width="30"
/>
</td>
</tr>
<tr>
<td colspan="2" style="text-align:center;">
1<input type="radio" name="rdoRate" value="1" >
2<input type="radio" name="rdoRate" value="2" >
3<input type="radio" name="rdoRate" value="3" >
4<input type="radio" name="rdoRate" value="4" >
5<input type="radio" name="rdoRate" value="5" >
6<input type="radio" name="rdoRate" value="6" >
7<input type="radio" name="rdoRate" value="7" >
8<input type="radio" name="rdoRate" value="8" >
9<input type="radio" name="rdoRate" value="9" >
10<input type="radio" name="rdoRate" value="10" >
</td>
</tr>
<tr><td colspan='4' align='center'><input type='submit' name='rate_submit' value='Rate'></td></tr>
</table>
</form>
PHP
if (isset($_POST['flag_submit_x']))
{
//Code to process the flagged image
}
if (!empty($_POST['rate_submit']))
{
//Code to process the rated image
}
有什么办法当按下单选按钮,我可以提交表单和检索的价值已按下的单选按钮?
在HTML中你需要一个按钮来发送数据。你需要为此使用js – nowhere
我正在使用PHP和HTML一起使用。 –