User475983607 posted
The code construct depends on the modal library you are using which you have not shared.
The code you have shared contains a submit which submits an HTML form. Any opened modal will be over written by the page refresh. You did not share all the relevant code or describe how the design is intended to work so the community cannot provide
accurate advice.
In addition to reading the modal docs, I recommend learning basic HTML forms rather than posting every little problem you have.