A hidden input submits a named value with a form but does not display an interactive control.
HTML hidden inputs: carry a token without treating it as secret
Implementation choice
A parcel release form carries a server-issued request token beside the decision. That token may help the backend distinguish an authorized form submission from a forged one, but only when the server issues, binds, checks, and expires it correctly. The hidden field is visible in page source and can be altered by the client. Never use it as the sole record of the parcel's owner, price, or approval state.
<form action="/parcels/P-47/release" method="post">
<input type="hidden" name="request_token" value="SERVER_ISSUED_PER_RESPONSE_TOKEN">
<p>Release parcel P-47 after the seal check.</p>
<button type="submit" name="decision" value="release">Confirm release</button>
</form>What remains outside the markup
The token value shown is a placeholder, not a usable security token. A production response must replace it with a cryptographically unpredictable value and verify the submitted value on the server along with the user's session and parcel permissions.
Cost and limits
The extra field is cheap. Token generation, storage or stateless verification, expiry, and replay rules add server work; correctness there matters far more than the HTML bytes.
Common Mistakes
- Do not hard-code a token into a real page.
- Do not assume hidden means confidential or immutable.
- Do not trust a submitted parcel ID or decision without server checks.
Connected lessons
- HTML forms: choose GET for retrieval and POST for a state change
- HTML form names and disabled controls: know which values submit
- HTML submit overrides: one form, two deliberate destinations
Apply this in HTML form error project: return values, summary links, and field repairs.
