gpt4 book ai didi

PHP Mysql单选按钮选择

转载 作者:行者123 更新时间:2023-11-29 05:29:36 24 4
gpt4 key购买 nike

有人可以帮我吗,我正在尝试实现一个简单的 php MySQL 调查,但我一直卡在这个问题上,如何将用户选择的特定选择存储在 MySQL 中。

您的满意度:

<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 文件

第一个是构建一种单选按钮形式。我已经删除了表格的元素以实现整洁的 View ,然后我们设置了第二页的 URL。如果您愿意,也可以是单个页面,但这更容易。

反馈.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>

在第二页我们捕捉到我们从第一页发布的内容

添加.php

  $result= $_POST['satisfaction'];
echo $result;

使用 $result 存储在您的数据库中。祝你好运

关于PHP Mysql单选按钮选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16125893/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com