【问题标题】:Echo radio or checkbox when it is called when info is in it回显收音机或复选框,当它在其中时被调用
【发布时间】:2012-10-13 22:59:23
【问题描述】:

我只是想问一个关于输入“收音机”和“复选框”的问题。 当该字段中有信息时,我如何才能学习如何回显或任何您称之为的仅呼出收音机或复选框。

如果我想制作一个表格并回显

 <input type="radio" name="" value="">

<input type="checkbox" name="" value="">

但我在该字段中只有 2 个输入或 4 个。

例子:

2 input

<input type="radio" name="" value="">

<input type="radio" name="" value="">



4

<input type="radio" name="" value="">

<input type="radio" name="" value="">

<input type="radio" name="" value="">

<input type="radio" name="" value="">

如果我的数据库中有 2 0r 4 个字段,或者我想让它两者都做。

只是问,以便我可以学习。感谢您的帮助,如果我在论坛的错误部分发布此内容,我们深表歉意。

【问题讨论】:

    标签: php input checkbox radio-button echo


    【解决方案1】:

    我不确定我是否理解你的正确,但如果我是正确的,你应该这样称呼它或类似于:

        <form action="php.php" method="post">
          <input type="radio" name="radio" id="radio" value="1" />
          <input type="radio" name="radio" id="radio" value="2" />
          <input type="radio" name="radio" id="radio" value="3" />
          <input type="radio" name="radio" id="radio" value="4" />
          <input type="submit" value="submit" />
       </form>   
    

    然后回应它

        if (isset($GET_['radio'])){
            $radio= $GET_['radio'];
            echo $radio;
        } 
    

    这将打印选中的收音机的值。

    【讨论】:

    • AT SiderQ - 感谢您的回复。我设置了像你一样的表格进行练习,因为这就是我想要的样子。现在,如果我想让它输入我的数据到 1,2 和 3,4 收音机不显示这意味着你看到的只有 1 和 2 带有单选按钮,下一个问题可以说有四个选项显示所有四个收音机显示。
    猜你喜欢
    • 2014-07-29
    • 2012-10-16
    • 1970-01-01
    • 2018-08-05
    • 1970-01-01
    • 1970-01-01
    • 2018-05-25
    • 2015-05-19
    • 2010-11-19
    相关资源
    最近更新 更多