Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host="localhost";
- $usua="root";
- $pass="";
- $base="php_practica";
- $cone = new mysqli($host,$usua,$pass,$base);
- if ($cone->connect_error) {
- die("Error de Conexion: " . $cone->connect_error);
- }
- ?>
- <?php
- include ("conexion.php");
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title> </title>
- </head>
- <body>
- <form method = "POST" action = "procesar.php">
- <h1 align ="center">Bienvenido</h1>
- <a href ="index.html"><ol>Pagina Principal</ol></a>
- <a href ="registrar.html"><ol>Registrar</ol></a>
- <a href ="listado.html"><ol>Listado</ol></a>
- <a href ="Sancion.html"><ol>Sancion</ol></a>
- <div> Ingrese su nombre </div>
- <input type="text" name="nombre">
- <div> Ingrese su apellido </div>
- <input type="text" name="apellido">
- <div> Ingrese su cedula </div>
- <input type="text" name="cedula">
- <div> Ingrese su rango </div>
- <div><select name="rango">
- <option value="1">First</option>
- <option value="2">Second</option>
- <option value="3">Third</option>
- </select></div>
- <input type="submit" value="enviar">
- </body>
- </html>
- <?php
- include ("conexion.php");
- include ("funciones.php");
- ?>
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title> </title>
- </head>
- <body>
- <form method = "POST" action = "funciones.php">
- <?php
- bd_agregar($_REQUEST);
- ?>
- </body>
- </html>
- <?php
- include ("conexion.php");
- function bd_agregar($temp){
- $nombre=$_REQUEST["nombre"];
- $apellido=$_REQUEST["apellido"];
- $cedula=$_REQUEST["cedula"];
- $rango=$_REQUEST["rango"];
- mysqli_query($cone,"INSERT INTO personal (nombre,apellido,cedula,rango)
- VALUES ('$nombre','$apellido','$cedula','$rango')");
- }
- //Revisar si guardo correctamente//
- if (mysqli_connect_errno($cone))
- {
- echo "Error al guardar los datos:" . mysqli_connect_error();
- }
- else
- {
- echo "Datos guardados correctamente:";
- }
- mysqli_close($cone);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement