0

this is a newbie question, but I don't know how to do. I have a form , but have two submit button and two action all no reaction. this is my view:

<form id="form1" name="form1" method="post">
輸入金額*:<input type="text" name="txtmoney" id="txtmoney" value="" required/><br>
<br>
<input type="submit" name="moneyout" id="moneyout" value="提款" action="/app_dev.php/bank/moneyout"/>
<input type="submit" name="moneyin" id="moneyin" value="存款" action="/app_dev.php/bank/moneyin"/>
<input type="reset" name="btnReset" id="btnReset" value="重填金額"/></div><br>
</form>
Vaibhavi S.
  • 1,083
  • 7
  • 20
Lai
  • 15
  • 1
  • 8
  • https://developer.mozilla.org/zh-CN/docs/Web/API/HTMLFormElement/action – mplungjan Oct 01 '19 at 08:23
  • Dupes https://stackoverflow.com/questions/17661645/change-form-action-based-on-submit-button https://stackoverflow.com/questions/2753308/different-form-action-depending-on-button-pressed – mplungjan Oct 01 '19 at 08:32

1 Answers1

4

If you want to specify the action in the submit buttons, you have to use the formaction attribute, not action.

<input type="submit" name="moneyout" id="moneyout" value="提款" formaction="/app_dev.php/bank/moneyout"/>
<input type="submit" name="moneyin" id="moneyin" value="存款" formaction="/app_dev.php/bank/moneyin"/>
Barmar
  • 741,623
  • 53
  • 500
  • 612
  • Dupe anyway: https://stackoverflow.com/questions/2753308/different-form-action-depending-on-button-pressed – mplungjan Oct 01 '19 at 08:31