top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the importance of "action" attribute in a html form?

+2 votes
528 views
What is the importance of "action" attribute in a html form?
posted Jan 11, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

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.

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).

answer Jan 12, 2016 by Manikandan J
0 votes

The purpose of the HTML action attribute is to specify the URL of a form processor (for example a PHP script which handles the form data).

That attribute is store the path at where Form data is handled.

<form action="Home.html">
        //form elements write hear.
</form>

In example action's value is Home.html so form data is handled at that page .

answer Mar 3, 2020 by Siddhi Patel
Similar Questions
...