HTML & CSS
Article
By Adam Roberts

action (HTML attribute)

By Adam Roberts
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

Description

A form is useless unless some kind of processing takes place after the form is submitted. The action attribute is used to inform the browser what page (or script) to call once the "submit" button is pressed.

--ADVERTISEMENT--

Example

Here, the action attribute tells the browser to send the form data to a form-handling PHP page (which will presumably convert the form data to something more email-friendly):

<form action="form-to-email.php" method="post"
    accept-charset="windows-1252">
  <div>
    <label for="txtname">Name:</label>
    <input type="text" name="txtname" id="txtname"/>
  </div>
 ⋮
</form>

Value

This element takes as its value a URL to a document that may be on the same server (for example, a shared CGI folder that has various form-processing scripts), or even a page or script on an entirely separate server (perhaps a free form-handling service).

Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the latest in Front-end, once a week, for free.