The HTML form action attribute defines what should happen to the data when a form is submitted on a web page. The value of the action attribute should be the URL of the web resource that will process the content of the form.
When you create forms and request data on your site or web application, you often want to do something with your data, right? This is where the shape action attribute comes into play .
form data is sent to the "action" URL when a submit button is clicked
example action from HTML form
Let an example look at:
Above, the action sends the username and email data to a page named process.html. the username and email data have type d ’input "text.‚" We define a button with the input type "submit.‚" When you click on it, this button will mark our data at our "action‚" URL.
Now enter the form example above - . it in an actual HTML file then . create a file called process.html in the same folder This file must have the following content:
This code defines a simple web page that shows a paragraph of text when The page is loaded. Return to our online form that we defined earlier and compile it:
In HTML4, the answer would be yes. of today with HTML5, there is no need to specify an action attribute. you have a form tag with no action attribute then the data will be sent to its own page.
The HTML form action attribute defines what happens to the content of a form when the form is submitted. The action attribute takes a URL as an argument.
Are you interested in becoming a web developer? Check out our Complete Guide to Learning HTML . You will find expert tips on learning HTML, as well as a list of the best online courses and learning resources .