Ver Mensaje Individual
  #4 (permalink)  
Antiguo 26/07/2011, 09:28
pintosz
 
Fecha de Ingreso: julio-2011
Mensajes: 5
Antigüedad: 12 años, 10 meses
Puntos: 0
Respuesta: Registro de usuario y envio de mail con info

Este es mi archivo insertar.php

//

<!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>enviando</title>
<style type="text/css">
body,td,th {
font-size: 12pt;
color: #FFF;
font-family: Arial, Helvetica, sans-serif;
}
body {
background-color: #CCCCCC;
background-image: url(line.jpg);
background-repeat: repeat-x;
margin-left: 500px;
margin-top: 155px;
margin-bottom: 0px;
}
</style>


</style>
</head>
<meta http-equiv="Refresh" content="3;url=http://www.enviossge.com.ve/bienvenido.html">

<body>




</script>

<?
// Primero comprobamos que ningún campo esté vacío y que todos los campos existan.
if(isset($_POST['nombre']) && !empty($_POST['nombre']) &&
isset($_POST['apellido']) && !empty($_POST['apellido']) &&
isset($_POST['direccion']) && !empty($_POST['direccion']) &&
isset($_POST['telfmovil']) && !empty($_POST['telfmovil']) &&
isset ($_POST['telffijo']) && !empty($_POST['telffijo']) &&
isset ($_POST['cedula']) && !empty($_POST['cedula']) &&
isset ($_POST['email']) && !empty($_POST['email'])) {


// Si entramos es que todo se ha realizado correctamente

$link = mysql_connect("localhost","enviossg_1","cpe$%2011" );
mysql_select_db("enviossg_datos",$link);

// Con esta sentencia SQL insertaremos los datos en la base de datos
mysql_query("INSERT INTO usuarios (nombre,apellido,direccion,telfmovil,telffijo,cedu la,email)
VALUES ('{$_POST['nombre']}','{$_POST['apellido']}','{$_POST['direccion']}','{$_POST['telfmovil']}','{$_POST['telffijo']}','{$_POST['cedula']}','{$_POST['email']}')",$link);

// Ahora comprobaremos que todo ha ido correctamente
$my_error = mysql_error($link);

if(!empty($my_error)) {

echo "Ha habido un error al insertar los valores. $my_error";

} else

echo "Sus datos han sido enviados, espere sus datos SGE";

}

else {

echo "Error, no ha introducido todos los datos";

}

exit;

?>

<?php
$para = $_POST['email'];
$titulo = 'Welcome';
$mensaje = 'Hola bienvenido a SGE';
$cabeceras = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($para, $titulo, $mensaje, $cabeceras);
?>


</body>
</html>