【问题标题】:Post choice of a radiobutton into another page to send into database将单选按钮的选择发布到另一个页面以发送到数据库
【发布时间】:2014-06-23 04:31:14
【问题描述】:

您好,我将单选按钮添加到 timesheet.php 中

<!-- creation des radiobuttons pour le choix. -->
    <div id="radioover" align="center"  >
        <input type="radio" name="group"style="background-color:transparent" id="option1" onClick="getvote();" /><strong>mettre en banque </strong>
        <input type="radio" name="group" style="background-color:transparent" id="option2" onClick="getvote();" /><strong>Paye nombre d'heure</strong>
    </div>

    <div id="radiounder" align="center"></br>
        <input type="radio" name="group" style="background-color:transparent "  id="option3" onclick="getvote();" /><strong>Prendre heures en banque</strong>
        <input type="radio" name="group" style="background-color:transparent "  id="option4" onclick="getvote();" /><strong>Paye nombre d'heure</strong>
    </div>

在我的 timesheet.php 中,我包含了我的真实页面 autocomplete.php,其中有我的完成按钮

<input type="submit" name="submit_val"  value="Terminé" id="end" />
<input type="hidden" name="data" value="<?php echo $date; ?>" />
<input type="hidden" name="usrUserName" value="<?php echo $usrUserName; ?>" />

当我点击完成时,我进入我的 insert.php 页面(我的 sql 在哪里插入数据库)

我需要帮助来保持我对单选按钮的选择。

如果有人检查“Payenombre d'heure”(选项 3),我需要放入变量 X = 3 如果是选项 2 被选中放入 x 编号 2。因为当我将插入到我的数据库中时,我将插入 X 作为选择。

我该怎么做?

【问题讨论】:

    标签: php sql radio-button checked


    【解决方案1】:

    将值标签添加到每个输入?

        <input type="radio" name="group" style="background-color:transparent" id="option2" value="2" onClick="getvote();" /><strong>Paye nombre d'heure</strong>
    

    【讨论】:

    • 我了解所有输入都包含在
      中,因此您可以在 insert.php 中查看表单的所有结果_POST 变量
    • 如您所见,我的单选按钮未设置为表单方法帖子。
    猜你喜欢
    • 1970-01-01
    • 2017-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-31
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    相关资源
    最近更新 更多