问题
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