Hello there,
I always see hidden fields use in forms and i will like to ask, what is it meant for and what are the advantages.
Regards
uses of hidden fields
Moderator: General Moderators
Re: uses of hidden fields
Hidden fields can be used as a way of passing data between webpages and maintaining their values. For example, a shopping cart could have you enter your address on one page and your credit card on another. Page 2 will have hidden fields containing the address that you entered previously. Hidden fields are read with PHP the same away any other field is, its just not visible to the user and therefore won't be changed.
There are other uses as well such as storing a checksum of some kind, to ensure that the origin of posted data is where your script expects it to come from.
There are other uses as well such as storing a checksum of some kind, to ensure that the origin of posted data is where your script expects it to come from.
-
Phoenixheart
- Forum Contributor
- Posts: 123
- Joined: Tue Nov 16, 2004 7:46 am
- Contact:
Re: uses of hidden fields
Just a slight notice, a hidden field's value can be changed easily using an inspector (like Firebug). So don't rely on it as a security method in any way.
In other words, as a developer, treat hidden fields exactly as other fields.
In other words, as a developer, treat hidden fields exactly as other fields.