HTML Forms

Photo by Cedrik Wesche on Unsplash

What are HTML Forms?

An HTML form is made up of <form> tags and <input> tags that allow the user to submit information to the application. This section of the HTML document allows users to interact with the application upon arriving at your website. For example, on most applications, you have a signup or login form. These are essential for obtaining the information of the user, finding them in the database, and displaying their information on the page that is specific to that user. A signup form, it’s responsible for making sure the data being saved to the database is good data through protection you wrote in your code and save their information to the database was confirmed the user input the appropriate/expected inputs.

HTML Form and Input Attributes

Attributes describe the characteristics or properties that an element will take. An HTML form has a variety of attributes that you can utilize but the more common ones especially for login/signup forms are the action and method attributes. The action attribute describes the action that is to be performed when a form is submitted. Typically this action is the URL that processes the submission. The method attribute specifies the HTTP method that is utilized when submitting a form. So say for this signup form, you would have a form tag that looks like this <form action="/signup" method="POST"></form> . You need to send a post request so that the controllers in your backend can process the data input in the form.

<form action="/signup" method="POST">
<input />

Try It Out!

Now that we went over some of the basics of building out a form, try it on your own! There are a lot of other attributes I didn’t go over and the way in which you build out a form is also dependent on the framework you use, so make sure you understand how to send requests using your specific framework/language! Forms are fun and are essential for web development. As always, happy coding!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store