HTML <form> Element Attributes
In HTML there are different properties accessible for <form> a component which is given underneath:
HTML Action Attribute
The activity property of <form> component characterizes the cycle to be performed on structure when the structure is submitted, or it is a URI to deal with the structure data.
The activity quality worth characterizes the site page where data continue. It tends to be .php, .jsp, .asp, and so on or any URL where you need to deal with your structure.
Note: If activity trait esteem is clear at that point structure will be prepared to a similar page.
Example:-
<!DOCTYPE html>
<html>
<head>
<title>form attributes</title>
</head>
<body>
<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>
</body>
</html>
Output:-
It will redirect to a new page “action.html” when you click on submit button
HTML Method Attribute
The strategy property characterizes the HTTP technique which program used to present the structure. The potential upsides of technique quality can be:
- POST: We can utilize the post worth of technique property when we need to deal with the touchy information as it doesn’t show the submitted information in URL.
- GET: The get worth of strategy characteristic is default esteem while presenting the structure. Be that as it may, this isn’t secure as it shows information in URL subsequent to presenting the structure.
Example:-
<form action=”action.html” method=”post”>
<form action=”action.html” method=”get”>