Open In App

HTML action Attribute

Last Updated : 05 Jan, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML action Attribute is used to specify where the form data is to be sent to the server after the submission of the form. When a user submits a form, the browser sends the data to the specified URL, allowing server-side scripts to handle the information and generate a response.

Note: It can be used in the <form> element. 

Syntax: 

<form action="URL">

Attribute Values: 

URL: It is used to specify the URL of the document where the data is to be sent after the submission of the form. 
The possible values of the URL are: 

URL

Description

absolute URL

It points to another website link. For Example:  www.gfg.org 

relative URL

It is used to point to a file within a webpage. For Example: www.geeksforgeeks.org

Example : This Example illustrates the use of action attribute in an HTML document.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>HTML action Attribute</title>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>HTML action Attribute</h2>
 
    <form action="test.php" method="post" id="users">
        <label for="username">Username:</label>
        <input type="text" name="name" id="username"><br><br>
 
        <label for="password">Password:</label>
        <input type="password" name="pass"  id="password">
    </form>
    <br>
    <button onclick="myGeeks()">Submit</button><br><br>
    <b>
      After Submitting the form-data will sent
      to the "test.php" page on the server.
      </b>
</body>
 
</html>


Output: 

Supported Browsers:  

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 4


Previous Article
Next Article

Similar Reads

How to Call an Action From Within Another Action in VueJS ?
In Vue.JS applications, we can call one action from within another as per the requirement for managing complex workflows. In this article, we will see the two different approaches with their practical implementation, through which we can perform this calling action. Table of Content Using MethodsUsing Event BusApproach 1: Using MethodsIn this appro
3 min read
How to Call an Action From Within Another Action in Vuex ?
Vuex is a state management library for Vue applications. As we know passing props can be tedious for complex applications with many components, Vuex makes this interaction very seamless and scalable. In Vuex, actions are functions that perform asynchronous operations and commit mutations to modify the state. In this article, we will learn How to ca
4 min read
What does the action attribute do in HTML Form Tag ?
The "action" attribute in the &lt;form&gt; tag specifies the URL where the form data should be submitted when the user submits the form. It defines the destination for processing the form input on the server side, such as a script, a server-side application, or an API endpoint. Syntax&lt;form action="URL"&gt; &lt;!-- Form fields --&gt;&lt;/form&gt;
1 min read
HTML DOM Form action Property
The HTML DOM Form action property allows accessing and modifying the action attribute of a form element through JavaScript. It determines the URL where form data is submitted when the form is submitted. Syntax: It is used to return the action property. formObject.actionIt is used to set the action property. formObject.action = URLProperty Values: U
3 min read
How href attribute is different from src attribute in HTML ?
In HTML5, the href and src attributes play distinct roles in defining paths or URLs, each associated with specific HTML elements. The href attribute, commonly found in an anchor (&lt;a&gt;) elements, points to the destination of hyperlinks, facilitating navigation. The src attribute, used with elements like &lt;img&gt; and &lt;script&gt;, specifies
1 min read
Explain Action’s in Redux
In this article, we are going to learn about Action in Redux. Actions are plain JavaScript object that contains information. Action is one of the building blocks of Redux. Redux is a state managing library used in JavaScript apps. It is used to manage the data and the state of the application. Uses of Redux: With the help of redux it is easy to man
5 min read
React.js Blueprint Action
Blueprint is a React.js UI toolkit that provides a wide range of customizable and well-designed icons. Blueprint Action is a part of this toolkit that provides a visual way to indicate the actions that the user can take. We can use the following procedure below to use Blueprint Action icons in your project. Blueprint Action Icons can be used in var
3 min read
Introduction to Redux (Action, Reducers and Store)
Redux is a state managing library used in JavaScript apps. It simply manages the state of your application or in other words, it is used to manage the data of the application. It is used with a library like React.Uses: It makes easier to manage state and data. As the complexity of our application increases. At the start, it is hard to understand bu
4 min read
How to wait resize end event and then perform an action using JavaScript ?
When we resize the browser window, the "resize" event is fired continuously, multiple times while resizing. We want the "resize" event to only be fired once we are done resizing. Prerequisite: To solve this problem we use two functions: setTimeout() functionclearTimeOut() function Example: We will use setTimeout() so that the function in which we w
2 min read
CSS touch-action Property
The touch-action CSS property is used to change the view of the selected element with respect to the change in touch by the user, For example, zooming the image, scrolling the image, etc. It is the action made by the touchscreen user on a particular region selected on the screen. Note: Panning is nothing but scrolling with one-finger on a touch-ena
4 min read