Action Attribute:
It is a URL where form data is processed. If action attribute value is blank then form will be
processed to the same page.
action attribute example:
<form action="action.html" method="post">
<label>User Name:</label><br>
<input type="text" name="name"><br><br>
<label>User Password</label><br>
<input type="password"name="pass"><br><br>
<input type="submit">
</form>
- When you click the submit button in a form, it sends the form data to the URL specified
in the "action" attribute. This means the information you entered will be sent to a file
on the server.
- The "action" attribute basically tells the form where to go and what to do when you
submit it.
<form action="action.html" method="post">
get method:
The get value of method attribute is default value while submitting the form. This is not
secure as it displays data in URL (in name/value pairs) after submitting the form.
<form action="action.html"method="get">
Target Attribute:
The "target" attribute in a form specifies where the response should be displayed after the
form is submitted.
- _self: The response will show up on the same page.
<form action=""action.html"" method="get" target="_self">
- _blank: The response will open in a new tab or window.
<form action=""action.html"" method="get" target="_blank">
- framename:The response will be displayed in a named iframe.
- _parent: The response will be displayed in the parent frame.
<form action=""action.html"" method="get" target="_parent">
- _top: The response will take over the whole window.
<form action=""action.html"" method="get" target="_top">