0
I have a form that will display the fields to be inserted in the bd, so far so good, the problem lies in the following:
I created a class (this file will receive several different requests) with the methods add
, edit
, delete
, find
, etc. I need that when sending my form in the file that will receive the request it discover which request I am sending (add
, edit
, delete
, etc.) and forward to the right method to treat the functionality, someone knows how to tell the form to execute a particular method of my class?
Edit - Added code
file: Servicoscontroller.php
class ServicosController extends AppController {
public function add() {
$servico = $_POST['servico'];
if (!$servico) {
echo 'Serviço inválido.';
} else {
$database->insert('servicos', [
'title' => $servico['title'],
'value' => $servico['value']
]);
}
}
}
the shipping form does not have any particularity for now.. are only 2 msm inputs...
Put the code there.
– rray