Files
prueba-aplicaciones-web/alumnos/register_post.php
Daniel Cortés f480b2942f initial commit
2019-12-12 16:05:20 -03:00

22 lines
392 B
PHP

<?php
require_once('../models/alumno.php');
require_once('../rut_validacion.php');
$rut = $_POST['rut'];
if(!validar_rut($rut)){
echo "ERROR";
header("location: /alumnos/registrar.php");
var_dump("OH NO");
exit();
}
$alumno = new Alumno();
$alumno->set_rut($_POST['rut']);
$alumno->set_nombre($_POST['nombre']);
if($alumno->save())
{
header("location: /alumnos/index.php");
}
?>