In my examples the value will always be an integer. The user is not expected to change the value of the field.
<input type="hidden" value="14" name="user_id" readonly/>
<input type="number" value="14" name="user_id" class="hidden" readonly/>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The only way to make a field hidden in HTML is to use
type="hidden". You may have been misled by the HTML5 featuretype="number". It’s not really comparable to typed variables in programming or types of fields in data formats. Instead, it is meant for creating a specialized user interface suitable for input of numeric data (such as a spinbox, possibly still allowing typing of numbers). This would be pointless, as you do not expect or even allow user input here.