From 7d7d7a336e8674a54292abe992b260d9cd2db192 Mon Sep 17 00:00:00 2001 From: filippo.bertilotti <filippobertilotti@gmail.com> Date: Mon, 10 Jun 2024 12:00:40 +0200 Subject: [PATCH] prova per prendere valori dal form e metterli nel database --- src/App/Controllers/fiat.php | 48 ++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/App/Controllers/fiat.php b/src/App/Controllers/fiat.php index 30f9ee7..4163ad2 100644 --- a/src/App/Controllers/fiat.php +++ b/src/App/Controllers/fiat.php @@ -1,11 +1,47 @@ <?php namespace App\Controllers; + +use App\Models\FiatModel; use Framework\Controller; -class Home extends Controller { - public function index() { - - echo $this->viewer->render("shared/header.php"); - - echo $this->viewer->render("Home/index.php"); +class Fiat extends Controller { + + public function __construct(private FiatModel $model) + { + } + public function index() { + return $this->view("Fiat/index.mvc.php", [ + ]); + } + + public function panda() { + return $this->view("Fiat/panda.mvc.php", [ + ]); + } + + public function fiat500() { + return $this->view("Fiat/fiat500.mvc.php", [ + ]); + } + + public function tipo() { + return $this->view("Fiat/tipo.mvc.php", [ + ]); + } + + public function contact() { + if($_SERVER['REQUEST_METHOD'] === 'POST') { + $data = [ + "email" => $this->request->post["email"], + "number" => $this->request->post["number"] + ]; + + $this->model->insert($data); + } + + + return $this->view("Fiat/contact.mvc.php", [ + ]); + } + } \ No newline at end of file -- Gitblit v1.8.0