How to use the formmethod attribute in HTML?


The formmethod attribute is used to define the HTTP technique for sending form information. This method is usedwith input type submit a picture. It overrides the method attribute of HTML forms.

Example

You can try to run the following code to learn how to use the formmethod attribute in HTML.

<!DOCTYPE html>
<html>
   <head>
      <title>HTML formmethod attribute</title>
   </head>
   <body>
      <form action=”/new.php” method="get">
         Student Name<br><input type="text" name="name"/><br>
         Student Subject<br><input type="text" name="subject"/><br>
         <input type="submit" value="Submit">
         <input type="submit" formmethod=”post” formaction=”/new2.php” value="Submit">
      </form>
   </body>
</html>

Updated on: 14-May-2020

97 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements