Skip to content

Instantly share code, notes, and snippets.

@luisdavid919
Last active August 12, 2018 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luisdavid919/8068a439bfeec56d689a102dda91a102 to your computer and use it in GitHub Desktop.
Save luisdavid919/8068a439bfeec56d689a102dda91a102 to your computer and use it in GitHub Desktop.
<?php
require_once 'config.php';
// Create connection
//$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
//if ($conn->connect_error) {
// die("Conexión Fallida: " . $conn->connect_error);
//}
$fecha=$_POST['fecha'];
$hora=$_POST['hora'];
$puerta=$_POST['puerta'];
$guardia=$_POST['guardia'];
$id=$_POST['id'];
$yesno=$_POST['yesno'];
$pas1=$_POST['pas1'];
$id1=$_POST['id1'];
$pas2=$_POST['pas2'];
$id2=$_POST['id2'];
$pas3=$_POST['pas3'];
$id3=$_POST['id3'];
$trabajador=$_POST['trabajador'];
$jefe=$_POST['jefe'];
$destino=$_POST['destino'];
$tax=$_POST['tax'];
$motivo=$_POST['motivo'];
$sql = "INSERT INTO worklist (fecha,hora,puerta,guardia,id,yesno,pas1,id1,pas2,id2,pas3,id3,trabajador,jefe,destino,tax,motivo) VALUES ('$fecha', '$hora','$puerta','$guardia','$id','$yesno','$pas1','$id1','$pas2','$id2','$pas3','$id3', '$trabajador','$jefe','$destino','$tax','$motivo');";
if ($conn->query($sql) === TRUE) {
echo "Información Agregada con Éxito";
header("location: trabajo.php");
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
@jjrr13
Copy link

jjrr13 commented Aug 12, 2018

Debes capturar primero todas las variables que llegan por POST asi:

$folio =$_POST['folio'];
$fecha =$_POST['fecha'];
hora =$_POST['hora'];
$puerta =$_POST['puerta'];
$guardia =$_POST['guardia'];
$id =$_POST['id'];
$yesno =$_POST['yesno'];
$pas1 =$_POST['pas1'];
$id1 =$_POST['id1'];
$pas2 =$_POST['pas2'];
$id2 =$_POST['id2'];
$pas3 =$_POST['pas3'];
$id3 =$_POST['id3'];
$trabajador =$_POST['trabajador'];
$jefe =$_POST['jefe'];
$destino =$_POST['destino'];
$tax =$_POST['tax'];
$motivo =$_POST['motivo'];

ReNiceCode...

@jjrr13
Copy link

jjrr13 commented Aug 12, 2018

si quieres comparteme el proyecto a mi gitHub yo miro haber en que te ayudo nombre de usuario: jjrr13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment