HTML Form Attributes
There are different types of attributes for the HTML
Example of POST method
<form action="test.php" method="post"> <label for="fname">Name:</label><br> <input type="text" id="name" name="name" value="Camila"><br> <label for="">Email:</label><br> <input type="text" id="email" name="email" value="camila@gmail.com"><br><br> <input type="submit" value="Submit"> </form>
Output
The Action Attribute
The action attribute defines any script URL which will receive uploaded form data.
Example of Action Attribute
<form action="test.php"> <label for="fname">Name:</label><br> <input type="text" id="name" name="name" value="Camila"><br> <label for="">Email:</label><br> <input type="text" id="email" name="email" value="camila@gmail.com"><br><br> <input type="submit" value="Submit"> </form>
The Target Attribute
The target attribute specifies the target page where the response of the script will be displayed.
The target attribute takes multiple values as follows:
- _blank,
- _self,
- _parent
- _top etc.
Example of target attribute
<form action="test.php" target="_blank"> <label for="fname">Name:</label><br> <input type="text" id="name" name="name" value="Camila"><br> <label for="">Email:</label><br> <input type="text" id="email" name="email" value="camila@gmail.com"><br><br> <input type="submit" value="Submit"> </form>