Beispiel #1
0
 public function crear()
 {
     if (!$_POST) {
         echo $this->view->render('preguntas/formulariopregunta');
     } else {
         if (!isset($_POST["asunto"])) {
             $_POST["asunto"] = "";
         }
         if (!isset($_POST["cuerpo"])) {
             $_POST["cuerpo"] = "";
         }
         $datos = array('asunto' => $_POST["asunto"], 'cuerpo' => $_POST["cuerpo"]);
         if (PreguntasModel::insert($datos)) {
             echo $this->view->render('preguntas/preguntainsertada');
         } else {
             echo $this->view->render('preguntas/formulariopregunta', array('errores' => array('Error al insertar'), 'datos' => $_POST));
         }
     }
 }