Video instructions and help with filling out and completing When 8850 Form Submitting

Instructions and Help about When 8850 Form Submitting

Hey YouTube how's it going it's Quinton here and welcome back to tutorial number 29 and in this video I just want to speak to you guys about submitting a form okay so in the previous tutorial I did say that we were going to start some form validation but I decided before we move on to that you guys should probably just understand fully what submitting form means and how we're going to use that in JavaScript okay so let's just start off by putting a form onto our web page so starting form and ending form okay and there are two attributes that are actually compulsory to have on our form we need to have them every time and the first one is the action which is basically where do I want to send the information I get from this form where do I want to send it to okay and this is going to be like another page on our website okay preferably something that's written with some server-side code okay so in other words it can't be a dot HTML file okay like it can't be another page that HTML because okay let's say another page was another page on our website if it was a dot HTML file it wouldn't be able to do anything with the values that we sent to it okay so we'd actually you know it would be pointless but if it was something like a dot PHP file then we'd be able to actually read the data that we sent to it and actually do stuff with the data save it in a database or something like that whatever okay so that's what the action does okay then we've got another attribute called the method and the method is basically all the data that we get in the form how do we want to send that data to this page okay so one way is by using the get method okay and what the get method does is it sends the data up as part of the URL and then the post method sends it as a separate page but I'll explain this in a few seconds let's just add some information in our in our form so let's just put in some input types here or input elements okay so let's make a login page where we can fill in our information and then click like a button that says login and see if we can login okay so let's just start off with the obviously a username and then we're also going to need a password and then we're going to need a button over here this is like submit or login okay so we'll put in an input of type text for the username so they can type in their name and we'll give this a name of username okay and I'm going to end that off just like that and then I'm going to copy this paste it down here okay and for the password I'm going to give it a type of password and I'm going to give it a name of password as well and down at the bottom over here I'm going to put in another input element but this one is going to be type submit' and then the value we can set to submit or actually let's set it to login okay so the value is just basically whatever appears on our button again so so now when I go ahead and I run this in Firefox okay you can see that I've got this form over here and right now it's asking for a username which we could go ahead and type in my name didn't spell it right okay and then the password like I'll just go ahead and say false 1 2 3 or something ok and now when I click this button okay what will happen is we going to send the that information that I fold in so this information over here to another page PHP which actually doesn't exist I haven't made it yet so we're going to get a bit of an error showing up on our web page and we're going to send it using this method called the get method ok so let's go ahead and click login and just like I told you the page doesn't exist so Firefox is giving me a file not found error but that's okay okay so let's just look at the URL over here and like I told you the get method sends the dots that we fold in up in the URL so right now if we look in our URL we've got this file which is basically way on my computer this file or that is located or where this computer is looking for this file ok then the page that we're supposed to be on is called another page dot PHP which doesn't exist so that's why we get this error but at the end here we've got this question mark and then we've got the username which is set to Quinton and password which is set to boss w123 so I I added in a W by accident by hey ok so that's basically how we send information using the get method it gets added on the URL so by the way if this webpage was on a live server then we wouldn't get all of this information up here we just get ww-whatever my website name is so like programmers creed or something programmers Creed comm slash another page dot PHP whatever this information is here okay so that would be like that's my domain this is the web page were on basically and these after the question mark over here these are all the oh that's all the information that I tried to send to the server using the get method okay so that's one way of submitting

Get Form