PHP Mysql单选按钮选择 [英] PHP Mysql radio buttons selection
问题描述
有人可以帮我吗,我正在尝试实施一个简单的 php MySQL 调查,但我坚持这一点,我如何将用户选择的特定选择存储在 MySQL 中.
Can someone help me please, I am trying to implement a simple php MySQL survey, but I am stuck on this, how do I store the specific selection in MySQL that users select.
您的满意度:
<table id="table1" rules="all" border="1" cellpadding="3" cellspacing="0" width="70%">
<colgroup width="70%"></colgroup>
<colgroup width="6%">
</colgroup>
<thead>
<tr align="center">
<th></th>
<th font="" style="font-size:9pt;" size="2"><b>Dissatisfied</b></th>
<th font="" style="font-size:9pt;" size="2"><b>Satisfied</b></th>
<th font="" style="font-size:9pt;" size="2"><b>Very Satisfied</b></th>
</tr>
</thead>
<tbody>
<tr align="center">
<td align="left"><font style="font-size:10pt;"><b>Technician's ability to understand the unique nature of your problem?</b></font></td>
<td><input name="satisfaction" value="Dissatisfied" type="radio"></td>
<td><input name="satisfaction" value="Satisfied" type="radio"></td>
<td><input name="satisfaction" value="Very Satisfied" type="radio"></td>
</tr>
<tr align="center">
</tbody>
</table>
推荐答案
为此,您需要表单来提交数据选择.您将需要两个 php 文件
for this what you need will need a form to submit data selection. You will need two php files
第一个是构建单选按钮形式.我已经删除了表格的元素以获得整洁的视图,然后我们设置了第二页的 URL.如果你愿意,也可以是单页,但这更容易.
The first one is to built a form of radio buttons. I had removed table's elements for neat view then we set the URL of the second page .Can also be a single page if you want but this is more easier.
反馈.php
<form action="add.php" method="post" accept-charset="utf-8">
<input name="satisfaction" value="Dissatisfied" type="radio">Dissatisfied<br>
<input name="satisfaction" value="Satisfied" type="radio">Satisfied<br>
<input name="satisfaction" value="Very Satisfied" type="radio">Very Satisfied<br>
<input type='submit' value="submit">
</form>
在第二页我们看到我们从第一页发布的内容.
add.php
$result= $_POST['satisfaction'];
echo $result;
使用 $result 存储在您的数据库中.祝你好运
using $result to store in your database. Good luck
这篇关于PHP Mysql单选按钮选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!