HTML - Form Methods: GET and POST

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone and welcome back in today's video we will learn how to sing our form data to the backend the form provides us with two different ways to send data first one is yet this is the default option and the second one is post form element provides us with an attribute called method to select either of these options let's try an example to understand these things better let's bring up our GUI editor so as I just mentioned form provides us with an attribute called method for this purpose so let's add a method so by default it's yet but still let's just use get here first let's savor so coming back to our form when we send data we are get it is visible in the browser's address bar let's try clicking the register button without filling the form and see what happens so when I click on register button as you can see in the URL we've got all these fields so we've got a full name email password confirm password security question and answer so these keys are the same values that we've given you in the name so for me we've given full - name for email we've given and just name just email for password you've given it password and so on so if I change it to just full name and I save it and I click on the register button and now as you can see the key is just full name and say for example if I remove the key let's save it and now if I click on register so the full name field is no more in the URL so as I mentioned earlier if you don't give a value to me then that input field is not sent to the park and so let's just vote it let's save it again let's fill the form this time so let's say Kathy Kathy Kohner during Gmail let's say password something confirm password something let's see mail let's say first job soft and let's click on register and now as you can see the URLs for full name we've got caffee for email you've got the email ID that we just entered for the password it's showing us here caffee and the same for confirm password and then for the gender and the security question first job and the answer is also here software developer so as you can see so whatever data we entered in the form is visible in the URL so this just means you cannot use get when you are sending some secure data so it can only be used when we are sending non secure data for example something which is not password or tokens also the page URLs have a character limit which is around 3000 characters so this makes get unsuitable for sending large data so for example if this text box except it's a 3,000 characters and someone actually wrote 3,000 characters so all that data would in listen to the bakken something would be trimmed out so this makes get unsuitable for sending large data so one example you can use get with a search box so when user clicks on the search button then you can send the search string as get request and it will be usable in the page URL which is absolutely alright now talking about the second option which was posed so if you are sending data of your post method then you don't need to worry about the character of the net because it has no size limitations also the post data is not visible in the URL so it is safe to send the sensitive data for example passwords or access tokens etc etc so if you are wondering what happens when this data goes to the backend or how is it processed what happens behind the scenes that is completely out of the scope of this video but I'll just give you a little idea about what happens so when this data is sent to the bakken back and parses all this data it needs to know okay this is the full this is the password this is a confirm password and that's why the values are in key value pairs and then depending on the business case if the data is just to be stored and the user is supposed to be created that's done and a success response the same to the front thing where you can just show us access pop up congratulations your account is created or etc etc that's just a top level idea about that we cannot go in the details at least not in this video that's all for today guys if there is something that you did not understand feel free to drop a comment and we will discuss it see you in the next video bye and take care
Info
Channel: EdYoda
Views: 91,471
Rating: undefined out of 5
Keywords: edyoda
Id: 3vdEHeql2mA
Channel Id: undefined
Length: 5min 17sec (317 seconds)
Published: Wed Feb 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.