Like most HTML elements, the <form> element can take attributes.
Although its not compulsory, it is standard practice to include 2 attributes in your <form>.
What are they?
You guessed it, I'm talking about the action and method attributes.
We will be covering the action and method attributes in a lot more detail later, but for now I want to reemphasize a few key points about them.
The action attribute defines the URL that the data will be sent to. In other words, it's where the input collected by the form is sent when the user clicks the submit button.
What is the URL?
When you send data over the wire, you are sending the data to a server. This means the URL needs to match the route on the server, so that the server knows how to process the data. Common backend technologies for processing forms include Node.js, PHP, and Ruby on Rails. In this course, we’ll mainly be focusing on the frontend for now.
The method attribute can be either post or get, both of which define how the form is submitted to the backend server. This is largely dependent on how your web server wants to handle the form, but the general rule of thumb is to use POST when you’re changing data on the server, and use GET for when you’re only fetching / getting data.