How to pass hidden information in a form in html?

十年热恋 提交于 2019-12-24 17:18:46

问题


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>

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?


回答1:


Use a hidden field:

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

The user will not see hidden inputs on the form.

If the value of the hidden form comes from php, you can use this:

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



回答2:


if i understand correctly you want to use the hidden input hidden input a great summary from w3schools



来源:https://stackoverflow.com/questions/17014129/how-to-pass-hidden-information-in-a-form-in-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!