![]() ![]() So what does a POST form look like? It's totally and completely different from GET requests. Even if someone knows the address of where you're going - like "totallyloggingintomybank.php", they're not going to get your authentication credentials because the variables aren't in the URL itself. This means if the connection is being sent over HTTPS, then all of that submitted information is encrypted. POST doesn't put the information into the URL so you can't bookmark it, but into the body of the submission itself. I'm not a security expert, but that's probably "bad." ![]() The password is right there in the address bar. Look - the password is obscured, so it's totally secure! And when we click "Submit", what appears in our URL? For example, suppose that we have this: Greetings, program! Please enter your username and password! Sounds great, right? Well, like everything in the universe, including duct tape, there is a light and dark side binding it together. Even better - now we can bookmark that page and be able to return to it whenever we want to. With this, our clever web server script will easily be able to find the values for firstName and lastName. When the user types in "Carl" and "Weathers" selects the "Submit" button, this is the address they are taken to: ![]() GET puts the information into the address field. There are other HTTP "verbs" out there, such as PUT, DELETE, etc, but the most commonly used are POST and GET. Let's take a moment to talk about POST and GET some more. Here's a simple sample form showing each of these elements: Submit: Once we have the information, we need to do something with it.Inputs: What information are we trying to get the user to do? Click a button, enter their name, select from a group of choices.POST: The information is part of the body of the request.GET: The information is part of the address field.Usually there are two methods, or "verbs": Method: How we're sending this information.Action: Where will this information be going (usually another web page).Declaration: This is where we specify "Hi - we're starting a form!".Every form requires the same basic elements: There are all sorts of forms, but let's cover the most simple ones. So with that - retrieving information from web pages was born through the use of elements called "forms." Today, we shall explore the wonderful world of forms - how to request information from users, and then how to retrieve what they have written to put it to some use. I was thinking more like "cure cancer" or "create a time machine from a microwave that turns bananas into gelnanas", but we did invent the Internet just for cat videos, so let's go with that. Like - allow people to edit cat videos to put in silly comments and share them with their friends? If we did that, we could even customize the web pages based on what they entered! We can do really important and useful things with that! Hey, how do we get information out of the reader so we can store it in these big fancy computers running the Internet? ![]() But sooner or later, someone had to mess it up and ask a simple question: They displayed information to the reader, perhaps if you were lucky, there would be pictures (Woah! Pictures!). Web pages, when they first appeared, were in a lovely, static state. IDE like Visual Studio Code with PHP Tools. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |