Welcome back to another cool lecture.
And to remind you, we're talking about the input where its type is set to hidden.
And in the previous lectures we've seen that there are 3 main uses for this input type, right?
The main use is to use it to help you when it comes to database lookups. Specifically, a popular use
of using input type hidden is to keep track of what database record needs to be updated.
Okay, Clyde, I get it.
But how does this work?
What is the typical workflow look like?
Well, I've broken it down into three very broad categories.
Step number one is the starting point, and here the user generally decides to edit some content they
have control over, such as a blog post or a product entry or their profile.
And of course the user starts this whole process by clicking on an edit button of some sort.
So that's the first step.
Very intuitive.
Step number two, is where the database comes into the picture, because the content to be edited has
to be taken from somewhere, right?
It has to be fetched from the database and loaded into an HTML form to allow the user to make changes.
And the final step is pretty intuitive as well.
After editing, the data is updated. And when the user submits the form, the updated data is sent back
to the server to be updated in the database.
So the idea here is pretty simple.
During step two, the ID of the record being updated is kept in a hidden input, right, in its value attribute.
So it may look like this, for example.
Make sense.
And then we get on to step three.
When the form is submitted, the ID is automatically sent back to the server with of course, the form
and record content.
And the ID is so important my students, because it lets the site's server side component know exactly
which record in the database needs to be updated, with the submitted data.
So I thought I'd spend just this lecture explaining why it's useful from a database perspective, and
I hope it's starting to make sense.
I hope you can kind of get an intuitive feel for how you would use this input type.
See you in the next lecture.