<?php require_once "agenda.php"; $name = $_POST["txtname"]; $phone = $_POST["txtphone"]; $email = $_POST["txtemail"]; $name = htmlentities($name); $phone = htmlentities($phone); $email = htmlentities($email); if ($name != null) { if (move_uploaded_file($_FILES["imagen"]["tmp_name"], "images/" . $_FILES["imagen"]["name"])) { $imagen = "images/" . $_FILES["imagen"]["name"]; } else { $imagen = "images/user.png"; } chmod("images/" . $_FILES["imagen"]["name"], 0777); $persona = new Agenda(); $persona->setAgenda("{$name}", "{$phone}", "{$email}", "{$imagen}"); //header("Location: http://localhost/php/agendas/insertar_agenda.php"); } else { header("Location: insertar_agenda.php"); } //echo "<br /><a href='insertar_agenda.php'>Volver a Insertar</a>"; //end of file