Creamos una página llamada
formulario.htm con el siguiente codigo
HTML Code:
<!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=iso-8859-1" />
<title>Recomendar a un amigo - Supropia.com</title>
</head>
<body>
<form method="POST" action="recomendar.php">
<p>Recomienda este sitio a un amigo:</p>
<p>Tu nombre:<br>
<input type="text" name="tunombre" size="20"><br>
Tu email:<br>
<input type="text" name="tuemail" size="20"><br>
Nombre de tu amigo:<br>
<input type="text" name="nombreamigo" size="20"><br>
Email de tu amigo:<br>
<input type="text" name="emailamigo" size="20"><br>
<br>
<input type="submit" value="Recomendar" name="B1"></p>
</form>
</body>
</html>
y luego otra llamada
recomendar.php con el siguiente código:
HTML Code:
<!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=iso-8859-1" />
<title>Recomendar a un amigo - Supropia.com</title>
</head>
<body>
<?
// Completamos la variable $asunto con el título del mensaje
// y armamos el mensaje dentro de la variable $mensaje
$asunto = "Un amigo te recomienda Supropia.com";
$mensaje = "Hola ".$nombreamigo.", tu amigo ".$tunombre." recomienda
que ingreses al sitio http://www.supropia.com/, en el cual podrás encontrar
diseño de páginas WEB y Alojamiento Web (Hosting).";
// Utilizamos la función mal() de PHP para realizar el envío
// del mensaje
mail($emailamigo, $asunto, $mensaje, "From: ".$tuemail);
?> Gracias por recomendarnos.<br />
Supropia.com
</body>
</html>
Tendremos que modificar el código de recomendar.php
$asunto = "
Un amigo te recomienda Supropia.com";
$mensaje = "
Hola ".$nombreamigo.", tu amigo ".$tunombre." recomienda
que ingreses al sitio http://www.supropia.com/, en el cual podrás encontrar diseño de páginas WEB y Alojamiento Web (Hosting).";
Espero que este Script te sea útil. Se adjunta en este mensaje un archivo ZIP con el ejemplo.