Hidden Inputs – Web Development

Articles, Blog

Hidden Inputs – Web Development

Hidden Inputs – Web Development


And the correct answer is we see two values in the URL, the value we submitted and the value we hardcoded in our code. So let’s take a quick look at this again. Recall that in our code, I added this extra input type hidden, name equals food, which matches this name and the value eggs, hardcoded. And then in our browser, when I click steak, the URL updates to have both steak, the one we’ve just added, and eggs in the URL. Let’s try a few more examples while we’re here. Let me try adding pizza. You can see steak, the one that came from us, changed to pizza, and eggs remained. Let’s see also what happens if I type in eggs. Now we get eggs twice. So you can see we always have the value that was in our hidden elements in the URL and then what came from the user is also there. But we can’t add multiple things quite yet. To be honest with you, I wasn’t actually sure what was going to happen when I was writing this lesson plan. Just happened to work out in a, in a way that I could make a nice example. And just goes to show you, you know, some of the stuff is a little tricky, but it’s very easy to just play around in your editor and in your browser to actually, you know, see what happens.

Leave a Reply

Your email address will not be published. Required fields are marked *