public function action_index() { if ($this->session->ouverte()) { $this->set_title("Module Nos voitures"); if ($this->req->name) { $db = DB::get_instance(); $modm = new ModeleManager($db); $imgm = new ImageManager($db); $mod = $modm->getByName($this->req->name); $cm = new CommentaireManager($db); if ($mod) { $idmodele = $mod->getIdModele(); $listeCom = $cm->listing($idmodele); $this->tpl->assign("com", $listeCom); $listeImg = $imgm->listing($idmodele); $this->tpl->assign("photo", $listeImg); } else { Site::redirect('loc', 'index'); } } else { Site::redirect('index'); } $fcom = new Form("?module=car&action=validcom&name=" . $this->req->name, "f_com"); $i = 0; $notes[] = ''; while ($i < 6) { $notes[] = $i; $i++; } $fcom->add_select("note", "note", "Note", $notes); $fcom->add_textarea("com", "com", ""); $fcom->add_submit("", "", "")->set_value("Envoyez"); $this->tpl->assign("f_com", $fcom); } else { Site::redirect("login"); } }
<html> <head> </head> <body> <form enctype="text/palin" method="post" action="valComm.php" name="f_comm" id="f_comm"> <fieldset> <input type="text" value="test" readonly="readonly" name="auteur" id="auteur"/> <label>Note</label><br /> <input type="radio" name="note" id="n1" value=1 />1 <input type="radio" name="note" id="n2" value=2 />2 <input type="radio" name="note" value=3 id="n3"/>3 <input type="radio" name="note" id="n4" value=4 />4 <input type="radio" name="note" value=5 id="n5"/>5<br /> Commentaires <br /> <textarea id="comme" name="comm"></textarea> <br /> <input type="text" value="porsche" readonly="readonly" name="voiture" id="voiture"/> <input type="submit" value="Envoyez"/> </fieldset> </form> <br /><br /> <?php $db = new PDO("mysql:host=localhost;dbname=location", "root", ""); $manage = new CommentaireManager($db); $manage->listing(); ?> </body> </html>