如何在html的表单中传递隐藏信息? [英] How to pass hidden information in a form in html?
本文介绍了如何在html的表单中传递隐藏信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何传递表单的隐藏信息?
How do I pass hidden information about a form?
<form action="index.php" method="post">
<textarea rows="2" cols="30" NAME="com" >
</textarea>
<input type="submit" name="com_submit" value="com" />
</form>
我需要看到评论是针对哪种类型的帖子传递的,所以我还需要通过这种形式传递变量 $type 的值,那么我该怎么做?
I need see that the comment is passed for which type of post so I need to pass the value of variable $type also by this form so how should I do that?
我是初学者,所以如果我问任何愚蠢的问题,我很抱歉?
I am a beginner so i am sorry if i am asking any stupid question?
推荐答案
使用 隐藏字段:
<input type="hidden" name="form_type" value="theFormType" />
用户不会在表单上看到隐藏的输入.
The user will not see hidden inputs on the form.
如果隐藏表单的值来自php,可以这样使用:
If the value of the hidden form comes from php, you can use this:
<input type="hidden" name="form_type" value="<?php echo $type ?>" />
这篇关于如何在html的表单中传递隐藏信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文