al correo si me llegan bien sin problema solo que en al base de datos no se me inserta nada sigue estando vacia les dejo el codigo tal vez sea un tonteria de principiante saludos y gracias espero respuesta buen dia
Nota edite los datos de conexion por seguridad
Cita:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bienvenido Gracias Por Participar</title>
</head>
<body>
<?php
///////Configuracion/////
$mail_destinatario = '[email protected]';
///////Fin configuraci贸n//
if (isset ($_POST['enviar'])) {
$headers .= "From: ".$_POST['email']. "";
if ( mail ($mail_destinatario,$_POST['asunto'],"Tratamiento: " .$tratamiento=$_POST['trato']. "Nombre: ".$nombre=$_POST['nombre']."Apellido: ".$apellido=$_POST['apellido']."Correo:".$correo=$_POST['correo']."Telefono: ".$telefono=$_POST['telefono']."Codigo Postal: ".$zip=$_POST['zip']."pais: ".$pais=$_POST['pais']." Asunto: ".stripcslashes ($asunto=$_POST['asunto'])."n Mensaje :n ".stripcslashes ($mensaje=$_POST['mensaje']), $headers )) echo '
Su mensaje a sido enviado correctamente. Gracias por contactar con nosostros
';
else echo '
Error al enviar el formulario. Por favor, intentelo de nuevo mas tarde.
'; }
//conexion de base de datos
$host = "localhost";
$usuario = "XXXXXX";
$clave = "XXXX";
$bd = "XXXXXX";
$link = mysql_connect ($host, $usuario, $clave);
if ($enviar) {
$link = mysql_connect("$host", "$usuario", "$clave");
mysql_select_db("$db",$link);
$sql = "INSERT INTO emails VALUES('$nombre', '$apellido', '$correo', 'email', '$telefono', '$zip', '$pais', '$mesaje')";
$result = mysql_query($sql);
}
echo '
<form action="?" method="post">
<label for="trato"> Tratamiento</label>
<select name="trato" size="1">
<option>Sr.</option>
<option>Joven</option>
<option>Sra.</option>
<option>Srita.</option>
</select><br>
<label for="asunto">Asunto: </label>
<input name="asunto" size="50" maxlength="80" type="text"><br>
<label for="nombre">Nombre: </label>
<input name="nombre" size="50" maxlength="80" type="text"><br>
<label for="apellido">Apellido: </label>
<input name="apellido" size="50" max="80" type="text"><br>
<label for="correo">Email: </label>
<input name="correo" size="50" maxlength="60" type="text"><br>
<label for="telefono">Telefono: </label>
<input name="telefono" size="20" maxlength="30" type="text"><br>
<label for="zip">Codigo Postal:</label>
<input name="zip" size="10" maxlength="10" type="text"><br>
<label for="pais">Pais</label>
<select name="pais" size="1">
<option>Mexico</option>
<option>Espa帽a</option>
<option>Estados Unidos</option>
<option>Resto del Mundo</option>
</select><br>
<label for="mensaje">Mensaje : </label>
<textarea name="mensaje" cols="31" rows="5"></textarea> <br>
<label for="enviar">
<input name="enviar" value="Enviar consulta" type="submit"></label>
</form>
';
?>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bienvenido Gracias Por Participar</title>
</head>
<body>
<?php
///////Configuracion/////
$mail_destinatario = '[email protected]';
///////Fin configuraci贸n//
if (isset ($_POST['enviar'])) {
$headers .= "From: ".$_POST['email']. "";
if ( mail ($mail_destinatario,$_POST['asunto'],"Tratamiento: " .$tratamiento=$_POST['trato']. "Nombre: ".$nombre=$_POST['nombre']."Apellido: ".$apellido=$_POST['apellido']."Correo:".$correo=$_POST['correo']."Telefono: ".$telefono=$_POST['telefono']."Codigo Postal: ".$zip=$_POST['zip']."pais: ".$pais=$_POST['pais']." Asunto: ".stripcslashes ($asunto=$_POST['asunto'])."n Mensaje :n ".stripcslashes ($mensaje=$_POST['mensaje']), $headers )) echo '
Su mensaje a sido enviado correctamente. Gracias por contactar con nosostros
';
else echo '
Error al enviar el formulario. Por favor, intentelo de nuevo mas tarde.
'; }
//conexion de base de datos
$host = "localhost";
$usuario = "XXXXXX";
$clave = "XXXX";
$bd = "XXXXXX";
$link = mysql_connect ($host, $usuario, $clave);
if ($enviar) {
$link = mysql_connect("$host", "$usuario", "$clave");
mysql_select_db("$db",$link);
$sql = "INSERT INTO emails VALUES('$nombre', '$apellido', '$correo', 'email', '$telefono', '$zip', '$pais', '$mesaje')";
$result = mysql_query($sql);
}
echo '
<form action="?" method="post">
<label for="trato"> Tratamiento</label>
<select name="trato" size="1">
<option>Sr.</option>
<option>Joven</option>
<option>Sra.</option>
<option>Srita.</option>
</select><br>
<label for="asunto">Asunto: </label>
<input name="asunto" size="50" maxlength="80" type="text"><br>
<label for="nombre">Nombre: </label>
<input name="nombre" size="50" maxlength="80" type="text"><br>
<label for="apellido">Apellido: </label>
<input name="apellido" size="50" max="80" type="text"><br>
<label for="correo">Email: </label>
<input name="correo" size="50" maxlength="60" type="text"><br>
<label for="telefono">Telefono: </label>
<input name="telefono" size="20" maxlength="30" type="text"><br>
<label for="zip">Codigo Postal:</label>
<input name="zip" size="10" maxlength="10" type="text"><br>
<label for="pais">Pais</label>
<select name="pais" size="1">
<option>Mexico</option>
<option>Espa帽a</option>
<option>Estados Unidos</option>
<option>Resto del Mundo</option>
</select><br>
<label for="mensaje">Mensaje : </label>
<textarea name="mensaje" cols="31" rows="5"></textarea> <br>
<label for="enviar">
<input name="enviar" value="Enviar consulta" type="submit"></label>
</form>
';
?>
</body>
</html>