How to Send Server-Unrelated Values from an HTML Form
Showcase
If you enter “your message” in the form above and submit it, then check the address bar, you’ll see that “subject=statistics” is included irrespective of the value you entered. This is useful when the same form is used in different contexts (i.e., the page’s purpose differs) or when there is a parameter the server must know but the user does not need to be aware of.
Code
HTML
<form id="example">
<input type="hidden" name="subject" value="statistics" />
<input type="text" name="input" placeholder="your message" />
<input type="submit" value="제출"></input>
</form>
type="hidden"
: creates an input field that the user cannot see. This field is transmitted to the server when the form is submitted. Don’t forget to set thevalue
attribute to the required value.