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 have created a class (this file will receive several distinct requests) with methods add
, edit
, delete
, find
, etc. I need to send my form to the file that will receive the request and find out which request I am sending ( add
, edit
, delete
, etc.) and forward to the right method to handle the functionality , does anyone know how I can tell the form to execute a certain 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']
]);
}
}
}
Since the submission form has no particularity for the moment, it's only 2 inputs msm ...