Caché

Solved
Aminax Posted messages 88 Status Membre -  
Aminax Posted messages 88 Status Membre -
Hello,

I need to know the purpose of hidden in forms; I know it's to hide a form field!! But what exactly is it for! Thanks in advance.

4 réponses

Jimpix Posted messages 12079 Registration date   Status Membre Last intervention   4 389
 
0
Aminax Posted messages 88 Status Membre
 
I have already read it!! But does it not answer my question hidden for other uses than hiding a field? And thank you for taking the time to read and respond!
0
mpmp93 Posted messages 2931 Registration date   Status Membre Last intervention   1 341
 
Good evening,

Non hidden has no other use.

Imagine that the form needs a unique random code, you are not going to display it, so:

<input type="hidden" name="xCode" value="<?php echo uniqid(); ?>"/>

See you!
0
Ysabe_l Posted messages 11924 Registration date   Status Contributeur Last intervention   277
 
Hello,

Hidden is used to hide something; it can be a field in a form, a div on a page, an image, or anything else. And then we can display it dynamically or not.

In the context of a form, if you don't see what it could be used for, it's simply because you don't need it. Its use isn’t frequent! But since you know it exists, the day you need it, you'll know how to use it.
0
mpmp93 Posted messages 2931 Registration date   Status Membre Last intervention   1 341
 
re-good evening,

It's more common than you think. For example, you post an article on a "blog". Someone wants to comment on it. So if the article has this URL:

http://www.mysite.com/index.php?displayArticle&id=23456

You put at the bottom of the page:

<form....>
<input type="hidden" name="idArticle" value="<?php echo (int) $_GET['id']; "/>
......
</form>

See you!
0
Aminax Posted messages 88 Status Membre
 
Thank you for your responses :)
0