Filter (Advanced Search)
Downloads
0
Views
238
Video

Video is not available... Embedded is previous playlist.

Details

The Action Attribute

The action attribute defines the action to be performed when the form is submitted.

Usually, the form data is sent to a file on the server when the user clicks on the submit button.

In the example below, the form data is sent to a file called "action_page.php". This file contains a server-side script that handles the form data:


<!DOCTYPE html>
<html>
<body>

<h2>HTML Forms</h2>

<form method="get" action="/php/action_page.php">
  <label for="fname">First name:</label><br>
  <input type="text" id="fname" name="fname" value="Bintu"><br><br>
  <label for="lname">Last name:</label><br>
  <input type="text" id="lname" name="lname" value="Chaudhary"><br><br>
  <input type="submit" value="Submit">
</form> 

<p>If you click the "Submit" button, the form-data will be sent to a page called "/action_page.php".</p>

</body>
</html>



Tip: If the action attribute is omitted, the action is set to the current page.

Ad