Caché

Solved
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 answers

  1. 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
    1. 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
  2. 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
    1. 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
  3. Thank you for your responses :)
    0