'Can input type = hidden be used to send information to a server?
Say I have
<input type="hidden" name="Content" id="Content_m">
Can I send a specific text to the server ? If so, is it done by adding a value field to form field?
Solution 1:[1]
Yes, you can:
<input type="hidden" name="Content" id="Content_m" value="your_text">
Solution 2:[2]
yes. to send info use value field like so:
<input type="hidden" value="iwanttosendthis" name="Content" id="Content_m">
Solution 3:[3]
Hidden inputs are submitted with the form as normal inputs.
You can retrieve whatever value the hidden input contained from (for example) $_POST in PHP:
$myVar = $_POST["Content"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | MillaresRoo |
| Solution 2 | alex |
| Solution 3 | James Hibbard |
