如何在html表单中传递隐藏信息


How to pass hidden information in a form in html?

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

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

我需要看到评论传递给哪种类型的帖子所以我需要通过这个表单传递变量$type的值那么我应该怎么做呢?

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

使用隐藏字段:

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

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

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

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

如果我理解正确的话,您想使用隐藏输入隐藏输入来自w3schools的精彩摘要