Re: primer mensaje a la lista (urgente)
| From: | Emiliano Horcada | Date: | Thu, 29 Sep 2005 12:25:32 +0000 |
| Subject: | Re: primer mensaje a la lista (urgente) | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-55990@lists.php.net to get a copy of this message | ||
Te paso una solución sencilla.
Te copio el HTM y luego el PHP. Letelo y adaptalo como te convenga.
HTM
<form action="http://www.URL.com/mails.php"
method="post" name="envio"
id="envio">
<div align="center">
<input type="hidden" name="redirect" value="
http://www.URL.com/contacto_gracias.htm"
/>
<input type="hidden" name="recipient" value="info@URL.com" />
<input type="hidden" name="subject" value="Contacto online" />
<table width="95%" border="0" align="center"
cellpadding="3" cellspacing="0"
class="tah11">
<tr>
<td width="34%" valign="top">Nombre y apellido<br>
<input name="Nombre y apellido" type="text" class="formulario"
id="nombre2"
size="35" />
<label> </label></td>
<td width="66%" valign="top">e-Mail <br> <input
name="email" type="text"
class="formulario" id="email" size="35" /></td>
</tr>
<tr>
<td colspan="2" valign="top">Comentarios y/o sugerencias<br>
<textarea name="Comentarios" cols="79" rows="5"
class="formulario"
id="textarea3"></textarea></td>
</tr>
<tr align="left">
<td colspan="2"> <input name="Submit" type="submit"
class="formulario"
value=" Enviar " />
<input name="Submit2" type="reset"
class="formulario" value="
Borrar " />
</td>
</tr>
</table>
</div>
</form>
PHP
<?
$message = $subject."<br><br>";
if (isset($_POST["Nombre y apellido"])) {
$from = $_POST["Nombre y
apellido"]."<".$_POST["email"].">";
} else {
$from = $_POST["email"];
}
$fromEmail = $_POST["email"];
foreach($_POST as $indice => $valor)
if(($indice<>"Submit") and ($indice<>"recipient") and
($indice<>"redirect")
and ($indice<>"subject"))
$message.= $indice.": ".$valor."<br>";
$headers = "Content-type: text/html;\n Content-Type: image/jpg;\n
Content-Transfer-Encoding: base64;\n charset=iso-8859-1\n";
$headers.= "From: ".$from."\r\n";
mail($recipient, $subject, $message, $headers);
echo "<script>parent.location='".$redirect."'</script>";
?>
Saludos,
Emiliano J. Horcada
On 9/29/05, Pablo Rodríguez <oinos@web.de> wrote:
>
> Hola a todas y todos,
>
> tengo que dejar colgada una página de internet para mañana y necesito
> tener un formulario de contacto en PHP. El único problema es que no sé
> PHP. El formulario está en
> http://steelbuilt.es/nuevapagina/contacto.html.
>
> Necesito que el script pueda enviar el mensaje en UTF-8 (así están las
> páginas y así no hay problemas con los acentos). Además, si tiene un
> ejemplo de integración en el html, pues me sería más fácil hacerlo.
>
> Os pediría una respuesta rápida.
>
> Perdonad las molestias y muchas gracias,
>
>
> Pablo
>
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>