enviar datos a tabla
Publicado por Francisco Javier (19 intervenciones) el 14/08/2020 09:14:45
A ver ...llevo meses con esto, lo abandoné pero me niego a hacerlo, tengo un formulario que enlaza con un action a una pagina vip.php ésta a su vez incluye una conexion .php pero los datos nunca llegan a una tabla que se llama causas que tengo subida en una base de datos que se llama qadr270. ahora os pongo las paginas para ver si sabeis que ocurre.En conexion.php el host,user y contraseña obviamente estan tapados. AYUDA!!!! orden: pirata.html vip.php y conexion.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html >
<html lang="es" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"charset="UTF-8" />
<title>pagina pirata</title>
<link rel="stylesheet" href="css/reservas.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<header>
<h1>Cliente Vip</h1>
</header>
<div id="wrapper">
<form action="vip.php" method="post">
<input type="text" placeholder="nombre"required>Nombre <br><br>
<input type="text"placeholder="Apellidos"required>Apellidos<br><br>
<input type="email"placeholder="Email"required>Email<br><br>
<input type="number"placeholder="Teléfono"required>Teléfono<br><br>
<input type="submit" value="Enviar"><br><br>
</form>
</div>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
include("conexion.php");
$id=$_POST['id'];
$nombre=$_POST['nombre'];
$apellidos=$_POST['apellidos'];
$email=$_POST['email'];
$telefono=$_POST['telefono'];
if (isset($_POST['registrarse'])){
$id=$_POST['id'];
$nombre=$_POST['nombre'];
$apellidos=$_POST['apellidos'];
$email=$_POST['email'];
$telefono=$_POST['telefono'];
$insertar="INSERT INTO causa(id, nombre, apellidos, email, telefono) VALUES ('$id','$nombre','$apellidos','$email','$telefono')";
$query=mysqli_query($conexion,$insertar);
if (!query){
echo "fallo al insertar";
}else{
echo "inserccion correcta";
}
}
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$host="##########";
$user="########";
$clave="########";
$sb="qadr270";
$conectar=mysqli_connect($host,$user,$clave,$sb);
If (!$conectar){
die("conexión mal ejecutada: ".mysqli_connect_error());}
echo"conexión correcta";
?>
Valora esta pregunta


0