Comunidad de diseño web y desarrollo en internet online

formulario no envia HTML

Citar            
MensajeEscrito el 21 May 2009 03:20 pm
Hola gente, se que esto se trato ya 40 millones de veces, pero no logro darle la vuelta despues de ver todo lo que hay en la comunidad.

El tema es el suigiente:

Tengo un formulario (html) que envia datos a mi correo y ademas envia una copia del mismo al que completo dicho formulario. Ahora, como quiero agregarle montones mas de campos al formulario, queria que se enviase en formato html para que no sea un simple texto :cool:
Pero no lo logro hacer, hace 4 dias que estoy con esto a fulltime y ya no me da la cabeza!! :shock:

Les paso los codigos para que lo vean.

HTML

Código :

<html>
<head>
<title></title>
<style>
BODY{color:#000000; font-size: 8pt; font-family: Verdana}
.button {background-color: rgb(128,128,128); color:#ffffff; font-size: 8pt;}
.inputc {font-size: 8pt;}
</style>
</head>

<body>

<form name="phpformmailer" action="formmail.php" align="center" method="post">
  <div align="center"><center><table bgcolor="#F2F2F2" width="528" cellspacing="6">
    <tr>
      <td width="499" colspan=2><strong>Formulario de Contacto :</strong></td>
    </tr>
    <tr>
      <td align="right" width="159"><small>Nombre y Apellido:</small></td>
      <td width="349"><font face="Arial"><input class="inputc" size="29" name="name"></font></td>
    </tr>
    <tr>
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Email:</small></td>
      <td align="left" width="349"><font face="Arial"><input class="inputc" size="29"
      name="email"></font></td>
    </tr>
    <tr align="middle">
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Confirmar Email:</small></td>
      <td width="349" align="left"><font face="Arial"><input class="inputc" size="29"
      name="email2"></font></td>
    </tr>
    <tr>
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Asunto:</small></td>
      <td width="349"><font face="Arial"><input class="inputc" size="29" name="thesubject"></font></td>
    </tr>
    <tr>
      <td align="right" width="159">&nbsp;<p><font color="#000080" size="1">*</font><small> Mensaje:</small></td>
      <td width="349"><textarea style="FONT-SIZE: 10pt" name="themessage" rows="7" cols="27"></textarea></td>
    </tr>
    <tr>
      <td width="159"></td>
      <td width="349"><script language="JavaScript"><!--
function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Ingrese un Email Valido.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("El Email ingresado no es igual a la confirmacion. Ingrese el mismo nuevamente.")
    email.focus()
  }
  if (thesubject.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Ingrese el Asunto.")
    thesubject.focus()
  }
  if (themessage.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Ingrese el mensaje.")
    themessage.focus()
  }
  if (okSoFar==true)  submit();
 }
}
// --></script><input type="button" class="button"
      value="Enviar" name="B1" ONCLICK="javascript:validateForm()"><small> <small>Debe llenar los campos marcados con *</small></small></td>
    </tr>
  </table>
  </center></div>
</form>
</body>
</html>


PHP

Código :

<?php

// ------- aqui lo configuro  -------------------------------------------------------
$valid_ref1="http://xxxxxx.com.ar/formmail.html";// dominio
$valid_ref2="http://www.xxxxxx.com.ar/formmail.html";// dominio
$replyemail="[email protected]";//email
// ------------------------------------------------------------

//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
 $patterns[0] = '/content-type:/';
 $patterns[1] = '/to:/';
 $patterns[2] = '/cc:/';
 $patterns[3] = '/bcc:/';
 if ($check_all_patterns)
 {
  $patterns[4] = '/\r/';
  $patterns[5] = '/\n/';
  $patterns[6] = '/%0a/';
  $patterns[7] = '/%0d/';
 }
 //NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
 return preg_replace($patterns, "", strtolower($value));
}


$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);

$error_msg='ERROR - no enviado. Intente nuevamente.';

$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
                   <p align="center"><strong>Su mensaje ha sido enviado<br>
                   </strong> y contestaremos a la brevedad posible.</p>
                   <p align="center">Ademas le hemos enviado una copia de su pedido.</p>
                   <p align="center">Gracias por contactarse.</p>';

$replymessage = "Hola $name

Gracias por su mensaje.

Nos contactaremos con usted a la brevedad posible.

Por favor no responda a este correo.

Su Email: $email
--------------------------------------------------
Asunto: $thesubject

Mensaje:

$themessage
--------------------------------------------------

Gracias";

// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
 echo "<script language=\"JavaScript\"><!--\n ";
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
 exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
 echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
 exit;
}
$themessage = "Nombre: $name \nMensaje: $themessage";
mail("$replyemail",
     "$thesubject",
     "$themessage",
     "From: $email\nReply-To: $email");
mail("$email",
     "$thesubject",
     "$replymessage",
     "From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
?>


Pregunten cualquier cosa, gracias a todos de antemano.
Saludos

Por nightpowa

22 de clabLevel



Genero:Masculino  

chrome
Citar            
MensajeEscrito el 21 May 2009 05:21 pm
en una de las cabeceras tienes q mandarle el mime type diciendole que es un text/html para que te pueda funcar saludos

Por talcual

686 de clabLevel



 

Colombia

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.