HTML Attributes

HTML action Attribute

The action attribute defines the URL that processes a form's data when it is submitted.


The action Attribute

The action attribute belongs to the <form> element. It holds the URL of the server-side program or endpoint that receives and processes the form data when the user submits the form. It works together with the method attribute, which decides whether the data is sent as a GET or POST request.

Syntax

ℹ️

Syntax: <form action="url" method="post">. The value is any valid URL, absolute or relative. If omitted, the form submits to the current page URL.

Submit an application to a server endpoint
<form action="/api/apply" method="post">
  <input type="email" name="email" required>
  <button type="submit">Submit application</button>
</form>
ValueDescription
/applyA relative URL on the same site
https://example.com/applyAn absolute URL to any server
(empty)Submits to the current page URL
mailto:you@example.comOpens an email client (not recommended for real forms)
💡

You can override a form's action per submit button using the formaction attribute on <button> or <input type="submit">, which is handy when one form has multiple submit targets.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships