Hello there,
Is it possible to have 2 method within the same endpoint file?
I have followed the tutorial:
But I would like to have more than one method (get, post, put) within one file,
please advise, thanks!!
Hello there,
Is it possible to have 2 method within the same endpoint file?
I have followed the tutorial:
But I would like to have more than one method (get, post, put) within one file,
please advise, thanks!!
Hello,
You can use multiple methods within the same point but you have to put some condition over there to handle multiple methods.
For ex:
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
... handle form submission here ...
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
... handle form submission here ...
}
if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
... handle form submission here ...
}
?>