Skip to content

Instantly share code, notes, and snippets.

@DDOrozco17
Created October 19, 2023 19:59
Show Gist options
  • Save DDOrozco17/345517bbcbd298f8c0ef366f437b57db to your computer and use it in GitHub Desktop.
Save DDOrozco17/345517bbcbd298f8c0ef366f437b57db to your computer and use it in GitHub Desktop.
bd formulario
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form action="productos.php" method="post">
Formulario datos de productos<br>
Apellido Paterno: <input type="text" name="txtap"><br>
Apellido Materno: <input type="text" name="txtam"><br>
Nombre: <input type="text" name="txtnombre"><br>
<input type="submit" value="Enviar">
</form>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<?php
echo "Diego Diaz Orozco <br>";
echo "Obtener datos del formulario index.php 5J ";
$con = mysqli_connect("localhost", "root", "", "bdpapeleria_ddo");
$txtap = $_POST['txtap'];
$txtam = $_POST['txtam'];
$txtnombre = $_POST['txtnombre'];
// database insert SQL code
$sql = "INSERT INTO tbl_productos (id, ap, am, nombre) VALUES (0, '$txtap', '$txtam', '$txtnombre')";
// insert in database
$rs = mysqli_query($con, $sql);
if ($rs) {
echo "<br> Se insertaron los datos";
}
?>
</body>
</html>
@DDOrozco17
Copy link
Author

image

@DDOrozco17
Copy link
Author

image

@DDOrozco17
Copy link
Author

image

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