How to make one form to add and edit at the same time?
There is a form. When editing the data it is sent to the page with the handler /edit, and when you add to the page handler /add. At the moment resolved at JS - inserted the desired action="/edit"or action="/add". But still I would like to solve it in php.
And the second point - preloading field values when using the edit form. I would like to find a solution based on these two things - bootstrapping and action on different URLs.
If the form is to substitute the data for editing, you can make a hidden field with the record ID, and it is the competent organization of storage certainly is. When sending data, the receiving script can look if there's id, then edit if missing or zero, then add
brando answered on July 9th 19 at 10:19
To add to the form hidden field _method: <input type="hidden" name="_method" value="POST">
And then in the form handler to perform the desired action. Typically, methods such appointments.