【问题标题】:How to pass hidden information in a form in html?如何在html中的表单中传递隐藏信息?
【发布时间】:2013-06-09 21:01:03
【问题描述】:

如何传递有关表单的隐藏信息?

<form action="index.php" method="post">
    <textarea rows="2" cols="30"  NAME="com" >
    </textarea>
    <input type="submit" name="com_submit" value="com" />
</form>

我需要看到评论是针对哪种类型的帖子传递的,所以我也需要通过这种形式传递变量 $type 的值,我应该怎么做?

我是初学者,如果我问任何愚蠢的问题,我很抱歉?

【问题讨论】:

    标签: php html forms textarea submit


    【解决方案1】:

    使用hidden field

    <input type="hidden" name="form_type" value="theFormType" />
    

    用户不会在表单上看到隐藏的输入。

    如果隐藏表单的值来自php,可以这样:

    <input type="hidden" name="form_type" value="<?php echo $type ?>" />
    

    【讨论】:

      【解决方案2】:

      如果我理解正确你想使用隐藏输入 hidden input w3schools 的精彩总结

      【讨论】:

        猜你喜欢
        • 2010-12-01
        • 2019-06-13
        • 2016-01-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-07-17
        • 2014-11-08
        相关资源
        最近更新 更多