function guardarTema() { $siglaCurso = $_POST['SiglaCursoTema']; $nombreTema = $_POST['NombreTema']; //crea el objeto tema $tem = new Tema(); $tem->crearTema($siglaCurso, $nombreTema); //ejecuta la funcion en TemaData que inserta un tema insertarTema($tem); }
$idCategoria = $_POST['categoria']; $nombreTema = $_POST['tema_nombre']; $idTema = $_POST['id_tema']; $validacion = getTemasById($idTema, $idCategoria); while ($val = mysqli_fetch_array($validacion)) { $resultado = $val[0]; } if ($resultado >= 1) { $notifMsg = "El tema introducido ya existe"; $notificacion = "ON"; $_SESSION['notifMsg'] = $notifMsg; $_SESSION['notificacion'] = $notificacion; header("Location:" . $_SERVER['HTTP_REFERER'] . " "); exit; } if ($idCategoria == "default") { $notifMsg = "Debes introducir una categoria"; $notificacion = "ON"; $_SESSION['notifMsg'] = $notifMsg; $_SESSION['notificacion'] = $notificacion; header("Location:" . $_SERVER['HTTP_REFERER'] . " "); exit; } insertarTema($idCategoria, $idTema, $nombreTema); $notifMsg = "El tema se ha creado correctamente"; $notificacion = "ON"; $_SESSION['notifMsg'] = $notifMsg; $_SESSION['notificacion'] = $notificacion; header("Location:" . $_SERVER['HTTP_REFERER'] . " "); } exit;