The course is part of this learning path
Forms are one of the core parts of HTML functionality. They let users submit key information and are used in every industry and on most websites. They’re a big topic, so in this module we’ll go into a lot of detail. You’ll learn about forms in general, text and push buttons and multi-line inputs. Then we’ll move onto checkbox and radio buttons, as well as list boxes and drop down lists. One of the more detailed lessons in this module comes up next, with a deep dive into some of the input types you can use in your forms. Finally, we’ll end the module off with form validation and a little bit about form validation, server scripting and a few security issues you need to be aware of.
One of the most powerful parts about HTML is the ability to create forms. We use forms for all sorts of things like sign up pages, login pages, surveys, online shopping and so much more because they are so powerful and aren't just about presenting information but actually capturing it too. Forms are a little more complicated than some other elements in HTML. Not complicated as in difficult to understand, but there are quite a few elements and actions you'll need to learn about.
So in this video we'll focus on just the form tag and it's attributes. A form is opened and closed with the form tag. The form tag has two major attributes, action and method. The action attribute tells the browser what to do with the information once a user submits it. The method attribute tells the browser how to do this. The GET method tells the browser to add the form information to the end of the action URL in the name value pairs separated by an ampersand after a question mark.
GET is great for simple forms where security really isn't an issue as the form details are actually displayed in the URL. Post on the other hand sends information in the form to a web server to be processed as part of the request body and you use it if security is a concern with things like passwords for instance. It is important to understand though that neither the GET nor the post method are actually secure. The only way to securely send data is to ensure that the website uses HTTPS.
Okay, so let's take a quick look at what this looks like in practice. First, I'll open up my form with the form tag. I need to follow this with the method, so I need to think about the kind of form I'm creating. The method will then either equal GET or post. This really depends on what method, the URL receiving the data is programmed to accept. Next I need to add an action. Tell the browser where to send the information. When the user submits it, I'll type action equals forward slash and then add in the URL, which could be relative or absolute. For now, let's say it's relative.
I'll make the action equal to this is where the data is sent to dot HTML. Now I can close the opening tag. After this, I normally add in all the other elements that would make up the form, but we'll get to those in other videos. So for now, I'll close the form like this and in the video. So yes, forms are a key foundation of web design because we use them to capture data that our users submit. In this video, we've just focused on how to create a form using the form tag and on the form tags method and action attributes.
- Text and Push Buttons, and Multi-Line Text Inputs
- Checkbox and Radio Buttons
- List Boxes and Drop Down Lists
- Input Types
- Form Validation
- Submitting Forms, Server Scripting Mechanisms, and Security Issues
About the Author