0

How do save data into a database with a button that is located different from the input form? this is my sample code

<form action="{{ route('store') }}">
@csrf
<input type="text" name="title"></form>
<form action="{{ route('store') }}">
@csrf
<button class="btn" type="submit">Submit</button></form>

when I run the code above, and output it via dd (...). it can't run. can the above code be used or do I have to combine the two things? when I wrap all of my divs with forms, it looks unresponsive (sorry, if my english so bad)

Sultan Achmad
  • 67
  • 1
  • 6
  • You can't submit two separate forms at the same time, because each submission represent a different request to the server. You may merge manually the fields of the two forms, or use Javascript to do this for you. – STA Oct 17 '20 at 14:17
  • It only submits the form that it belongs to. You can use the `js` to do what you want. – Cà phê đen Oct 17 '20 at 14:17
  • 1
    does this question help [Submit two forms with one button](https://stackoverflow.com/questions/7843355/submit-two-forms-with-one-button) – bhucho Oct 17 '20 at 14:18
  • 1
    Does this answer your question? [Submit two forms with one button](https://stackoverflow.com/questions/7843355/submit-two-forms-with-one-button) – Cà phê đen Oct 17 '20 at 14:19

0 Answers0