It only took me 12 years of web development to discover this, but button elements have a
form attribute that can be used to submit a form from anywhere in the document. This
form attribute must contain the ID of the form that you want it to submit.
Here is a full example below.
<form id="super-form" action="/"> <label for="superNintendoGame">Favourite Super Nintendo Game</label> <input type="text" name="superNintendoGame" id="superNintendoGame"> <button type="submit">Submit button inside form</button> </form> <button type="submit" form="super-form">Submit button outside form</button>