Professional Documents
Culture Documents
!doctype HTML Head Meta Title Title Meta
!doctype HTML Head Meta Title Title Meta
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>formulario</title>
<meta name="viewport" content="width=device-width, initial-
scale=1, shrink-to-fit=no">
<link rel= "stylesheet" href= "css/bootstrap.css" >
<link rel= "stylesheet" href= "css/font-
awesome.css" >
<link rel= "stylesheet" href= "css/all.css" >
<link rel= "stylesheet" href= "css/mdb.css" >
</head>
<body>
<br>
<br>
<br>
<br>
<div class= "row" >
<div class= "col-3" ></div>
<div class= "col-6" >
</div>
</body>
</html>
<?php
$host= "localhost" ;
$user= "root" ;
$pwd= "" ;
$db= "redsocial" ;
if ( $mysqli ->connect_errno) {
echo "Falló la conexión a la Base de Datos";
}
return $mysqli;
?>
<?php
require_once('../lib/conexion.php');
$nombre = $_POST['nombre'];
$cant = $_POST['cantidad'];
$precio = $_POST['precio'];
echo 'por '.$cant.' '.$nombre.' tiene que pagar : '.
($precio*$cant);
header("Refresh:5; url=../formulario.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>formulario</title>
<meta name="viewport" content="width=device-width, initial-
scale=1, shrink-to-fit=no">
<link rel= "stylesheet" href= "css/bootstrap.css" >
<link rel= "stylesheet" href= "css/font-
awesome.css" >
<link rel= "stylesheet" href= "css/all.css" >
<link rel= "stylesheet" href= "css/mdb.css" >
</head>
<body>
<br>
<br>
<br>
<br>
<div class= "row" >
<div class= "col-3" ></div>
<div class= "col-6" >
</div>
<script>
$(document).ready(function(){
$('#enviar').on("click", function(e){
e.preventDefault(); //evita que la página se
actualise
var frm = $('#formulario2').serialize();
//conpactar todos los datos a una sola variable
$.ajax({
type:'POST',
url:'prueba/datos.php',
data: frm,
success:function(resp){
$('.respuesta').html(resp);
}
});
});
});
</script>
</body>
</html>
<?php
$host= "localhost" ;
$user= "root" ;
$pwd= "" ;
$db= "productos" ;
if ( $mysqli ->connect_errno) {
echo "Falló la conexión a la Base de Datos";
}
return $mysqli;
?>
<?php
require_once('../lib/conexion2.php');
$nombre = $_POST['nombre'];
$cant = $_POST['cantidad'];
$precio = $_POST['precio'];
$resp = $mysqli->query($sent);
if ($resp){
echo "los datos se guardaron correctamente";
}else{
echo "no se guardaron los datos";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>formulario</title>
<meta name="viewport" content="width=device-width, initial-
scale=1, shrink-to-fit=no">
<link rel= "stylesheet" href= "css/bootstrap.css" >
<link rel= "stylesheet" href= "css/font-
awesome.css" >
<link rel= "stylesheet" href= "css/all.css" >
<link rel= "stylesheet" href= "css/mdb.css" >
</head>
<body>
<br>
<br>
<br>
<br>
<div class= "row" >
<div class= "col-3" ></div>
</div>
if ( $mysqli ->connect_errno) {
echo "Falló la conexión a la Base de Datos";
}
return $mysqli;
?>
<?php
require_once('../lib/conexion3.php');
$nombre = $_POST['nombre'];
$ape = $_POST['ape'];
$direc = $_POST['direc'];
$edad = $_POST['edad'];
$email = $_POST['email'];
$resp = $mysqli->query($sent);
if ($resp){
echo "los datos se guardaron correctamente";
}else{
echo "no se guardaron los datos";
}
?>