As I continue to learn HTML and PHP there is one thing I'd just do not understand. You create a <form>, build the various input types, 'text', 'password', etc and usually a 'submit' type. Then you build another input type of 'hidden', with accompanying name and value attributes.
In the PHP code you then issue an if (isset($_POST['name attribute'])), which checks the name attribute of the hidden type.
Why use the hidden attribute? You can just as easily use the name attribute of the submit type?
A hidden form control also has a value. You can use it to "save state" with a multi-page form. I use it to indicate that the form has been validated by JavaScript.
“The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
—Tim Berners-Lee, W3C Director and inventor of the World Wide Web
Normally hidden fields are used to contain values that are either created/changed by Javascript OR you have multiple instances of the form each of which has a different value for the hidden field so that you can tell which of the forms it was did the submission.
Also the submit button may not be passed with the form if the form is submitted without actually clicking on the button but by some other means. Only currently selected buttons are passed with the form.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Bookmarks