Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/05/2008, 23:44
otto1303
 
Fecha de Ingreso: noviembre-2006
Ubicación: Evergreen Street
Mensajes: 239
Antigüedad: 17 años, 5 meses
Puntos: 2
Respuesta: Formulario multicontacto

Bueno este es el archivo formulario.html

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>..::Contacto::..</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body,td,th {
	font-family: Trebuchet MS;
	font-size: 10pt;
}
-->
</style></head>

<body>
<form name="form1" method="post" action="proceso.php">
  <table width="28%"  border="0" align="center">
    <tr>
      <td colspan="2" align="center"><h3>Formulario de Contacto </h3></td>
    </tr>
    <tr>
      <td width="29%" align="right" valign="top">Nombre:</td>
      <td width="71%"><input name="nombre" type="text" id="nombre"></td>
    </tr>
    <tr>
      <td align="right" valign="top">Email:</td>
      <td><input name="email" type="text" id="email"></td>
    </tr>
    <tr>
      <td align="right" valign="top">Para:</td>
      <td><select name="para" id="para">
        <option>Escojer uno...</option>
        <option value="[email protected]">Jorge</option>
        <option value="[email protected]">Mar&iacute;a</option>
        <option value="[email protected]">Mario</option>
      </select></td>
    </tr>
    <tr>
      <td align="right" valign="top">Mensaje:</td>
      <td><textarea name="mensaje" id="mensaje"></textarea></td>
    </tr>
    <tr>
      <td colspan="2" align="center"><input type="submit" name="Submit" value="Enviar"></td>
    </tr>
  </table>
</form>
</body>
</html>
Luego proceso.php

Código:
<?php



// Receiving variables
@$pfw_ip= $_SERVER['REMOTE_ADDR'];
@$nombre = addslashes($_POST['nombre']);
@$email = addslashes($_POST['email']);
@$para = addslashes($_POST['para']);
@$mensaje = addslashes($_POST['mensaje']);

// Validation
if (strlen($nombre) == 0 )
{
die("<p align='center'><b><font face='Trebuchet MS' size='3' color='#FF0000'>Falta el nombre</font></b></p>");
}

if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
die("<p align='center'><b><font face='Trebuchet MS' size='3' color='#FF0000'>El E-mail debe ser válido</font></b></p>");
}

if (strlen($email) == 0 )
{
die("<p align='center'><b><font face='Trebuchet MS' size='3' color='#FF0000'>El E-mail debe ser válido</font></b></p>");
}



if (strlen($mensaje) == 0 )
{
die("<p align='center'><b><font face='Trebuchet MS' size='3' color='#FF0000'>Falta el Mensaje</font></b></p>");
}

//Sending Email to form owner
$pfw_header = "From: $nombre\n"
  . "Reply-To: $nombre\n";
$pfw_subject = "Mensaje del Sitio";
$pfw_email_to = "$para";
$pfw_message = "Visitor's IP: $pfw_ip\n"
. "nombre: $nombre\n"
. "email: $email\n"
. "mensaje: $mensaje\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

//Sending auto respond Email to visitor
$pfw_header = "From: [email protected]\n"
  . "Reply-To: $para\n";
$pfw_subject = "Mensaje recibido";
$pfw_email_to = "$nombre";
$pfw_message = "$nombre hemos recibido el mensaje. Si necesita respuesta pronto le responderemos.";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;

 echo("<p align='center'><b><font face='Trebuchet MS' size='5' color='#008000'>El mensaje se ha enviado.</font></b></p>");
?>
En el campo select para ponés la lista de los correos y los nombres de los que recibiran el correo.