html form multiple submit code example

Example 1: multiple form submit for different form action

<form method="POST">
<input type="submit" formaction="default_url_when_press_enter" style="visibility: hidden; display: none;">
<!-- all your inputs -->
<input><input><input>
<!-- all your inputs -->
<button formaction="action1">Action1</button>
<button formaction="action2">Action2</button>
<input type="submit" value="Default Action">
</form>

Example 2: two buttons in same form

<input type="submit" name="button_1" value="Click me">

Example 3: same form two submits

<input type="submit" formaction="example.php">
<button type="submit" formaction="mail.php"> Button</buttton>

Tags:

Html Example