2
I make this request:
app js.:
fetch(URL + ?controller=UserController&action=insert,
{
method: 'POST',
body: formData
})
fetch php.:
$controllerName = $_GET['controller'];
$actionName = $_GET['action'];
$nome = $_POST['nome']
To recover the data entered in the form, I use $_POST
. To recover the parameter of url
one $_GET
. It is correct to use both in the same php file, and I am making a request via method "POST
"?
Yes, because you are passing information via query string URL. As much as PHP calls
$_GET
, there is no direct relationship with the methodGET
of HTTP. In fact, the name (and existence) of these variables were an unhappiness in the development of language by inducing the developer to this relationship that does not exist.– Woss
Got it. So the methods have no direct relationship. Thanks for helping me.
– Francis Moura