-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguardar.php
More file actions
30 lines (29 loc) · 767 Bytes
/
guardar.php
File metadata and controls
30 lines (29 loc) · 767 Bytes
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
<?php
//conectamos Con el servidor
$conectar=@mysql_connect('localhost','root','');
//verificamos la conexion
if(!$conectar){
echo"No Se Pudo Conectar Con El Servidor";
}else{
$base=mysql_select_db('prueba');
if(!$base){
echo"No Se Encontro La Base De Datos";
}
}
//recuperar las variables
$nombre=$_POST['nombre'];
$correo=$_POST['correo'];
$mensaje=$_POST['mensaje'];
//hacemos la sentencia de sql
$sql="INSERT INTO datos VALUES('$nombre',
'$correo',
'$mensaje')";
//ejecutamos la sentencia de sql
$ejecutar=mysql_query($sql);
//verificamos la ejecucion
if(!$ejecutar){
echo"Hubo Algun Error";
}else{
echo"Datos Guardados Correctamente<br><a href='index.html'>Volver</a>";
}
?>