Foros del Web » Programando para Internet » PHP »

Problema con send.php

Estas en el tema de Problema con send.php en el foro de PHP en Foros del Web. Hola , Soy nuevo cn php y lo unico qe se utilizar mas o menos es lo del formulario pero el problema es que al ...
  #1 (permalink)  
Antiguo 16/03/2011, 10:55
 
Fecha de Ingreso: octubre-2010
Ubicación: San juan Argentina
Mensajes: 95
Antigüedad: 13 años, 6 meses
Puntos: 0
Exclamación Problema con send.php

Hola , Soy nuevo cn php y lo unico qe se utilizar mas o menos es lo del formulario pero el problema es que al poner todo bien , NO LLEGAN LOS MENSAJES AL CORREO .
. Aca les dejo el codigo HTML y el PHP

Código HTML:
<form action="send.php" method="post" form id ="Contacto">
                  <div class="nombreyapellido">Nombre y Apellido:</div> <div class="nombre"><input name="nombre" type="text" /> </div>
                  <div class ="Telefono">Telefono:</div> <div class="telefono"><input name="telefono" type="text" /></div> 
                  <div class ="Email">Email:</div> <div class="email"><input name="email" type="text" /></div>
                  <div class="Asunto">Asunto:</div> 
                  <div class="asunto"> <input name="asunto" type="text" /></div>
                  <div class="Mensaje">Mensaje:</div> <div class="mensaje"><textarea name="mensaje" cols="30" rows="5"></textarea> </div>
                  
                  <div class="Enviar"><input name="submit" type="submit" value="Enviar" /></div> 

PHP
Código PHP:
<?php

$nombre 
$_POST['nombre'];
$telefono $_POST['telefono'];
$email $_POST['email'];
$asunto $_POST['asunto'];

$header 'From: ' $mail " \r\n";
$header .= "X-Mailer: PHP/" phpversion() . " \r\n";
$header .= "Mime-Version: 1.0 \r\n";
$header .= "Content-Type: text/plain";

$mensaje "Este mensaje fue enviado por " $nombre ", con el asunto de " $asunto " \r\n";
$mensaje .= "Su e-mail es: " $mail " \r\n";
$mensaje .= "Mensaje: " $_POST['mensaje'] . " \r\n";
$mensaje .= "Enviado el " date('d/m/Y'time());

$para '[email protected]';
$asunto 'Mensaje desde Opcionesdealquiler.com.ar';

mail($para$asuntoutf8_decode($mensaje), $header);
echo 
'Mensaje enviado correctamente';
echo 
"<a href='index.html'>  Volver a Inicio  </a>";
?>
Muchas gracias !
  #2 (permalink)  
Antiguo 16/03/2011, 11:51
Avatar de carlosmderio3  
Fecha de Ingreso: marzo-2011
Ubicación: valencia
Mensajes: 67
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: Problema con send.php

Ya lo tienes mas mejorado http://www.megaupload.com/?d=P18LCWIF
saludos modificalo a tu gusto.

tenes que subir todos los archivos al host.
  #3 (permalink)  
Antiguo 16/03/2011, 12:55
 
Fecha de Ingreso: octubre-2010
Ubicación: San juan Argentina
Mensajes: 95
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Problema con send.php

Gracias pero la Imagen ! del captcha no entiendo no sale !!! em explcias eso rgacias ;)
  #4 (permalink)  
Antiguo 16/03/2011, 13:16
Avatar de carlosmderio3  
Fecha de Ingreso: marzo-2011
Ubicación: valencia
Mensajes: 67
Antigüedad: 13 años, 1 mes
Puntos: 0
Respuesta: Problema con send.php

la imagen es de color rojo, la subes en el mismo directorio.
captcha.php usa y crea el codigo, y el fondo es la imagen...
entonces los archivos van todos juntos en el mismo directorio.

el formulario se llama contacto_email.php
al que le puedes cambiar de nombre, sin tener que editar el script

el captcha.php (si lo cambias deberas cambiar el resto del script), asi como:
procesar.php / fondocaptcha.gif / formestilo.css

contacto_email.php
Código PHP:
<?php session_start(); ?> 
    <!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>Formulario de contacto</title>
    <link href="formestilo.css" rel="stylesheet" type="text/css">
</head>
    <body>
        <form name="formulario" action="procesar.php" method="post"> 
Nombre: (obligatorio)<br /> <input name="nombre" type="text" size="60"><br />

Teléfono (obligatorio): <br /> <input name="telefono" type="text" size="60"><br />

email: (obligatorio)<br /> <input name="email" type="text" size="60"><br />

Asunto: (obligatorio)<br /> <input name="asuntow" type="text" size="60"><br />

Comentarios: (obligatorio)<br /><textarea class="texto" name="comentarios" rows="4" cols="70"></textarea>
<br />(obligatorio)<br />
<img src="captcha.php" width="100" height="30"><br />
<input name="tmptxt" type="text" size="12">
<br /><hr />
  <p>Aceptas las condiciones:<br />
    <a href="terminos.php">Lea los Términos y condiciones de:</a> <strong>sitio web</strong></p>
  <p>Si (obligatorio)
    <input name="aceptas" type="checkbox" id="chequea" />
  No podr&aacute; enviar su consulta si no acepta los T&eacute;rminos.<br />
  <br />
  <label>
    <input type="submit" name="button" id="button" value="Enviar">
  </label>
  <br />
  </p>
    </form>
</body>
</html>
captcha.php

Código PHP:
<?php session_start(); 
function 
captcha($length) { 
$pattern "1234567890abcdefghijklmnopqrstuvwxyz"
for(
$i=0;$i<$length;$i++) { 
$key .= $pattern{rand(0,50)}; 

return 
$key



$_SESSION['tmptxt'] = captcha(8); 
$captcha imagecreatefromgif("fondocaptcha.gif"); 
$colText imagecolorallocate($captcha000); 
imagestring($captcha5167$_SESSION['tmptxt'], $colText); 
header("Content-type: image/gif"); 
imagegif($captcha); 
?>
procesar.php

Código PHP:
<?php session_start();
    if (
$_SESSION['tmptxt'] != $_POST['tmptxt']) { 
    echo 
"<script>window.alert('IMAGEN DE SEGURIDAD INVALIDA');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['nombre'])){ 
    echo 
"<script>window.alert('COLOQUE SU NOMBRE');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['asuntow'])){ 
    echo 
"<script>window.alert('COLOQUE SU NOMBRE');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['telefono'])){ 
    echo 
"<script>window.alert('COLOQUE UN NÚMERO DE TELÉFONO DE CONTACTO');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['email'])){
    echo 
"<script>window.alert('COLOQUE UN EMAIL DE CONTACTO');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    } 
    elseif(!
eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$_POST['email'])){
    echo 
"<script>window.alert('COLOQUE UNA DIRECCIÓN DE EMAIL VÁLIDA');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['aceptas'])){ 
    echo 
"<script>window.alert('ACEPTE LAS CONDICIONES DE ESTE SITIO');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
    if (!(
$_POST['comentarios'])){ 
    echo 
"<script>window.alert('LO MÁS IMPORTANTE -> INTRODUZCA SU COMENTARIO');</script>;";;
    echo 
"<script>location.href='javascript:history.back()' ;</script>;";
    exit(); 
    }
      
$recipiente "[email protected]"
      
$asunto "Contacto desde la Pagina WEB ";
      
$message .=" *********************************************<br>";
      
$message .=" ********** Contacto desde la Pagina WEB ********* <br>";
      
$message .=" *********************************************<br>";
      
$message .="Nombre: ".$_POST['nombre']."<br>";
      
$message .="Asunto: ".$_POST['asuntow']."<br>";
      
$message .="E-mail: ".$_POST['email']."<br>"
      
$message .="Telefono: ".$_POST['telefono']."<br>";
      
$message .="Comentarios: ".$_POST['comentarios']."<br>";
      
$message .="********************************************** <br>";
      
$message .="********************************************** <br>";
      
$message .="IP: ".$_SERVER['REMOTE_ADDR']."<br>";
      
$message .="FECHA: ".date("d/m/Y")."<br>";
      
$message .="HORA: ".date("h:i:s a")."<br>";
      
$message .=" ********************************************* <br>";
      
$message .=" ************ sitio web ************ <br>";
      
$message .=" *********************************************<br>";
      
$message stripslashes($message);
      
$headers "MIME-Version: 1.0\r\n"
      
$headers .= "Content-type:text/html; charset=iso-8859-1\r\n"
      
$headers .= "From: ".$_POST['email']."\r\n"
      
$headers .= "Repaly-to: $email\r\n"
      
$headers .= "Cc: ".$_POST['email']."\r\n";  
      
mail($recipiente,$asunto,$message,$headers); 
      echo 
"El mensaje se envio correctamente";
      
?>
formestilo.css
Código CSS:
Ver original
  1. body {
  2.     margin: 16px;
  3.     padding: 0;
  4.     font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  5.     font-size: 12px;
  6.     color: #333;
  7. }
  8.  
  9.  
  10. input, textarea, select  {
  11.     float: left;
  12.     font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
  13.     font-size: 12px;
  14.     color: #333;
  15.     padding: 2px;
  16.     width: auto;
  17.     margin-bottom: auto;
  18.     font-weight:bold;
  19.     height: auto;
  20. }
  21. label {
  22.     float: left;
  23.     width: 100px;
  24. }
  25. button {
  26.     width: 80px;
  27.     background: #333;
  28.     color: #FFF;
  29.     padding: 3px 8px;
  30. }
  31. form {
  32.     border: solid 1px #CCC;
  33.     background: #efefef;
  34.     padding: 16px;
  35.     width: 450px;
  36. }
  37. texto { font-weight:bold; }
  38. br { clear: both; }
aqui esta el codigo...

si queres te subo el que estoy usando ahora... que esta en marcha.... que es un poco mas complejo pero seguro que te puede servir si es para alguna empresa o negocio/personal.
  #5 (permalink)  
Antiguo 16/03/2011, 14:09
 
Fecha de Ingreso: octubre-2010
Ubicación: San juan Argentina
Mensajes: 95
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Problema con send.php

gracias en eso estoy ! la pagina es esta pro si qeres revisarla es algo sencilla


http://opciones.truefreehost.com/

Pruebo y respondo
  #6 (permalink)  
Antiguo 16/03/2011, 14:19
 
Fecha de Ingreso: octubre-2010
Ubicación: San juan Argentina
Mensajes: 95
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Problema con send.php

Lo que hice fue traspasar los codigos a los qe tenia yo y reemplazarlos y les cambie el nombre de destino pero hay un problema la imagen sigue sin apareceer , Coloco cada codigo asi verificas si hay algo mal

este se llama contacto.html
Código HTML:
Ver original
  1. <form name="formulario" action="send.php" method="post">
  2. Nombre: (obligatorio)<br /> <input name="nombre" type="text" size="60"><br />
  3.  
  4. Teléfono (obligatorio): <br /> <input name="telefono" type="text" size="60"><br />
  5.  
  6. email: (obligatorio)<br /> <input name="email" type="text" size="60"><br />
  7.  
  8. Asunto: (obligatorio)<br /> <input name="asuntow" type="text" size="60"><br />
  9.  
  10. Comentarios: (obligatorio)<br /><textarea class="texto" name="comentarios" rows="4" cols="70"></textarea>
  11. <br />(obligatorio)<br />
  12. <img src="captcha.php" width="100" height="30"><br />
  13. <input name="tmptxt" type="text" size="12">
  14. <br /><hr />
  15.   <p>Aceptas las condiciones:<br />
  16.     <a href="terminos.php">Lea los Términos y condiciones de:</a> <strong>sitio web</strong></p>
  17.   <p>Si (obligatorio)
  18.     <input name="aceptas" type="checkbox" id="chequea" />
  19.   No podr&aacute; enviar su consulta si no acepta los T&eacute;rminos.<br />
  20.   <br />
  21.   <label>
  22.     <input type="submit" name="button" id="button" value="Enviar">
  23.   </label>
  24.   <br />
  25.   </p>
  26.     </form>

Este Se llama send.php
Código PHP:
Ver original
  1. <?php session_start();
  2.     if ($_SESSION['tmptxt'] != $_POST['tmptxt']) {
  3.     echo "<script>window.alert('IMAGEN DE SEGURIDAD INVALIDA');</script>;";;
  4.     echo "<script>location.href='javascript:history.back()' ;</script>;";
  5.     exit();
  6.     }
  7.     if (!($_POST['nombre'])){
  8.     echo "<script>window.alert('COLOQUE SU NOMBRE');</script>;";;
  9.     echo "<script>location.href='javascript:history.back()' ;</script>;";
  10.     exit();
  11.     }
  12.     if (!($_POST['asuntow'])){
  13.     echo "<script>window.alert('COLOQUE SU NOMBRE');</script>;";;
  14.     echo "<script>location.href='javascript:history.back()' ;</script>;";
  15.     exit();
  16.     }
  17.     if (!($_POST['telefono'])){
  18.     echo "<script>window.alert('COLOQUE UN NÚMERO DE TELÉFONO DE CONTACTO');</script>;";;
  19.     echo "<script>location.href='javascript:history.back()' ;</script>;";
  20.     exit();
  21.     }



y los demas como me los mandaste vos . estoy trabajando con dreamweaver

Etiquetas: send, formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 06:30.