The “formaction” Attribute in HTML5
November 3, 2018
Using HTML5’s “formaction” attribute, you can have an unlimited number of Submit buttons in a Web form and have each button link to a different destination.
Here’s an example:
<form action="process_main.php" method="get"> <label for="fname"> First name: <input type="text" id="fname" name="fname"> </label> <br> <label for="lname"> Last name: <input type="text" id="lname" name="lname"> </label><br> <input type="submit" value="Default Submit"> <input type="submit" formaction="process1.php" value="Submit to Page1"> <input type="submit" formaction="process2.php" value="Submit to Page2"> <input type="submit" formaction="process3.php" value="Submit to Page3"> </form>
Test Live in JSFiddle:
Want to learn more? Christian recommends: