Insert in the database

0

I am trying to insert records in the database but when I enter the browser, it sends me to the address http://localhost/Vista/validarInsertarMedico.php and that file is in the Driver folder

I have the form

<form id="form2" name="form2" method="post" action="../Controlador/validarInsertarMedico.php">
  <table width="42%" border="0" align="center">
    <tr bgcolor="#cc0000" class="texto">
      <td colspan="2" align="center">INSERTAR MEDICO</td>
    </tr>
    <tr>
      <td width="28%" align="right" bgcolor="#fbec88">Identificación</td>
      <td width="72%"><label for="identificacion"></label>
      <input name="identificacion" type="text" id="identificacion" size="40"  required /></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#fbec88">Nombres</td>
      <td><input name="nombres" type="text" id="nombres" size="40" required /></td>
    </tr>
    <tr>
      <td height="25" align="right" bgcolor="#fbec88">Apellidos</td>
      <td><input name="apellidos" type="text" id="apellidos" size="40" required/></td>
    </tr>
    <tr>
     <tr>
      <td height="25" align="right" bgcolor="#fbec88">Especialidad</td>
      <td><input name="especialidad" type="text" id="espacialidad" size="40" required/></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#fbec88">Telefono</td>
      <td><input name="Telefono" type="text" id="Telefono" size="40" required/></td>
    </tr>
    <tr>
      <td align="right" bgcolor="#fbec88">Correo</td>
      <td><input name="Correo" type="text" id="Correo" size="40" required/></td>
    </tr>
    <tr>
    </tr>
    <tr bgcolor="#cc0000" class="texto">
      <td colspan="2" align="center" bgcolor="#cc0000"><input type="submit" name="button" id="button" value="Enviar" /></td>
    </tr>
  </table>
</form>

then validate insert doctor

<?php
    session_start();
    extract($_REQUEST); //recoger todas las variables que pasan Método GET o POST
    require "../Modelo/conexionBasesDatos.php";
    require "../Modelo/Medico.php";
    //Creamos el objeto Paciente
    $objMedico= new Medico();
    $objMedico->CrearMedico($_REQUEST['identificacion'],$_REQUEST['nombres'],$_REQUEST['apellidos'],
    $_REQUEST['especialidad'],$_REQUEST['telefono'],$_REQUEST['correo']);

    $resultado = $objMedico->agregarMedico();
    if ($resultado)
        header ("location:index2.php?pag=insertarPaciente&msj=1");
    else
        header ("location:index2.php?pag=insertarPaciente&msj=2");

    ?>

and the database connection file

 <?php
 function Conectarse()
 {
    $objConexion = new mysqli("localhost","root","gue55me","centromedico");
    if ($objConexion->connect_errno)
    {
        echo "Erro de conexion a la Base de Datos ".$objConexion->connect_error;
        exit();
    }
    else
    {
        return $objConexion;
    }
}
?>

I would appreciate your help because when you enter the form you are not sending me to the correct address that is Controller / validateInsertMedico.php

    
asked by Ramses Bagett Sierra 06.03.2018 в 02:30
source

0 answers