Form submits a GET request without a submit-button
jonasbirkelof opened this issue · comments
I have a login form that looks like this.
<form>
<button>Send</button>
</form>
No form method
, no button type="submit"
or anything but the form will still send a GET
request.
The router looks like this:
$Router->get('/login', [LoginController::class, 'index']);
I want to use onclick="myFunction()"
on the button to manage the form and then use JS inside the function to submit the form. I don't want the html to make the post request. This has worked before when I have not used a router so I suspect it has something to do with that.
Why does the form make a GET
request even without a submit button?
When I look at $_SERVER['REQUEST_METHOD']
after I load the page it is GET
. Does it have anything to do with that?
I just had a brain fart... Changing the <button>
to a <input type="button">
solved it.