Sometimes,. we want to make an HTML form with two submit buttons and two "target" attributes.
In this article, we’ll look at how to make an HTML form with two submit buttons and two "target" attributes.
How to make an HTML form with two submit buttons and two "target" attributes?
To make an HTML form with two submit buttons and two "target" attributes, we add the formaction
attribute to each button.
For instance, we write
<!DOCTYPE html>
<html>
<body>
<form>
<input
type="submit"
formaction="firsttarget.php"
value="Submit to first"
/>
<input
type="submit"
formaction="secondtarget.php"
value="Submit to second"
/>
</form>
</body>
</html>
to set the formaction
attribute of each button to the URL to make the request to when we click on it.
Conclusion
To make an HTML form with two submit buttons and two "target" attributes, we add the formaction
attribute to each button.