Foros del Web » Programando para Internet » PHP »

Formulario

Estas en el tema de Formulario en el foro de PHP en Foros del Web. tengo un formulario en php que confirma los datos en este segundo php que por algún motivo el servidor me pide que agregue ini_set(sendmail_from,'[email protected]'); y ...
  #1 (permalink)  
Antiguo 07/12/2008, 07:37
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Pregunta Formulario

tengo un formulario en php que confirma los datos en este segundo php que por algún motivo el servidor me pide que agregue ini_set(sendmail_from,'[email protected]');

y cuando lo hago me tira error en linea 49. Alguien me puede decir que está mal?

Código php:
Ver original
  1. <html>
  2. <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  3. <title>Formulario</title>
  4. </head>
  5.  
  6. <SCRIPT language=JavaScript src="scripts.js" type=text/javascript></SCRIPT>
  7. <body background="fondo2.gif">
  8. <?php
  9. if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
  10. {
  11. echo "<h3></h3>\n";
  12. $badinput = "<h3>Su direccion electronica no es valida o esta mal escrita, reingresela por favor.</h3>\n";
  13. echo $badinput;
  14. }
  15.  
  16. $todayis = date("l, F j, Y, g:i a") ;
  17.  
  18. $asunto = $asunto ;
  19. $subject = $asunto;
  20.  
  21. $nota = stripcslashes($nota);
  22.  
  23. $message = " $todayis [EST] \n
  24. - ASUNTO: $asunto \n
  25. - ESCRIBE: $nombre ($email)\n
  26. - TITULO DEL MENSAJE: $asunto\n
  27. - MENSAJE:
  28. $nota \n
  29.  
  30.  
  31. ------------------------------------------------------------------------------------------------------------------------------------\n
  32. - INFORMACION ADICIONAL: IP = $ipi \n
  33. - NAVEGADOR USADO: $httpagenti \n
  34. - SE CONTACTO DESDE LA PAGINA: $httprefi \n
  35. ";
  36.  
  37. ini_set(sendmail_from,'[email protected]');
  38. $from = "From: Formulario desde la web$email\r\n";
  39.  
  40. mail("[email protected]", $subject, $message, $from);
  41.  
  42. ?>
  43.  
  44. <p>&nbsp;</p>
  45. <p>&nbsp;</p>
  46. <div align="center"> /*esta sería la linea 49 que me da error*/
  47. <table border="0" id="table1" cellspacing="0" cellpadding="0" width="780">
  48. <tr>
  49. <td width="70" height="344">
  50. <p align="center">
  51. <br>
  52. <img border="0" src="dflateral.gif" width="70" height="139"><p align="center">
  53. <br>
  54. <font color="#FFFFFF">Home<br>
  55. &nbsp;</font><p align="center">&nbsp;</td>
  56.             <td><br>
  57. &nbsp;</td>
  58.             <td width="640" valign="bottom">
  59.             <table border="0" id="table2" cellspacing="0" cellpadding="0" height="399" width="769">
  60.                 <tr>
  61.                     <td height="15" width="203"></td>
  62.                     <td height="15" width="28"></td>
  63.                     <td height="15" width="5"></td>
  64.                     <td height="15" width="194"></td>
  65.                     <td height="15" width="5"></td>
  66.                     <td height="15" width="194" colspan="2"></td>
  67.                     <td height="15" width="140">
  68.                     <p align="center">
  69.                     <SCRIPT language=JavaScript type=text/javascript>
  70.                                     <!--   
  71.                                         escribir('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="120" HEIGHT="20" id="musica" ALIGN="">');
  72.                                         escribir('<param name="movie" value="musica.swf">');
  73.                                         escribir('<param name="quality" value="high">');
  74.                                         escribir('<embed src="musica.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" WIDTH="120" HEIGHT="20"></embed>');
  75.                                         escribir('</object>');
  76.                                     //-->
  77.                                   </SCRIPT>
  78.                     </td>
  79.                 </tr>
  80.                 <tr>
  81.                     <td height="20" width="203">&nbsp;</td>
  82.                     <td height="20" width="425" colspan="5" align="center">
  83.                     <form method="post" action="sendform.php" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
  84.                     <p><font color="#FFFFFF" face="Arial">Confirmación de envío</font><p><br>
  85.         &nbsp;<b><font face="Tahoma" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#FFFFFF">Fecha:</strong><?php echo $todayis ?><strong>
  86. <br />
  87.         Remitente:</strong><?php echo $nombre ?>( <?php echo $email ?> )<strong>
  88.         </strong></font></font>
  89.         <p align="center"><font face="Tahoma" size="2"><strong>
  90.         <font size="2" face="Tahoma" color="#FFFFFF">Su Mensaje:<?php $notesout = str_replace("\r", "<br/>", $nota);echo $notesout; ?> </font>
  91.         </strong></font>
  92.         <p align="center"><font face="Tahoma" size="2">
  93.         <font size="2" face="Tahoma" color="#FFFFFF">
  94.         <strong>
  95. <br />
  96.         Su Direccion IP:<?php echo $ip ?> <br />
  97.         Referido desde:<?php echo $httpref ?> </font>  
  98. <p align="center"><a href="respuesta_ok.php" style="text-decoration: none">
  99. <font color="#FFFFFF" face="Tahoma" size="2">[CONFIRMAR]</font></a></td>
  100.                     <td height="20" width="71" align="center">
  101.                     &nbsp;</td>
  102.                     <td height="20" width="70" align="center">
  103.                     &nbsp;</td>
  104.                 </tr>
  105.                 <tr>
  106.                     <td height="20" width="203">&nbsp;</td>
  107.                     <td height="20" width="28">&nbsp;</td>
  108.                     <td height="20" width="5">&nbsp;</td>
  109.                     <td height="20" width="194">&nbsp;</td>
  110.                     <td height="20" width="5">&nbsp;</td>
  111.                     <td height="20" width="194" colspan="2">&nbsp;</td>
  112.                     <td height="20" valign="bottom" width="140">
  113.                     <img border="0" src="DA.gif" width="167" height="26"></td>
  114.                 </tr>
  115.             </table>
  116.             </td>
  117.         </tr>
  118.         </table>
  119. </div>

Última edición por GatorV; 08/12/2008 a las 09:50
  #2 (permalink)  
Antiguo 07/12/2008, 07:47
Avatar de jcxnet  
Fecha de Ingreso: octubre-2005
Ubicación: Perú
Mensajes: 784
Antigüedad: 18 años, 6 meses
Puntos: 56
Respuesta: Formulario

ini_set(sendmail_from,'[email protected]'); define un parámetro del archivo php.ini que determina desde que dirección de email se envían los mensajes cuando se utiliza la función mail de php.
Primero es necesario saber si estás usando php sobre linux o sobre win, esto es determinante para poder solucionar este problema.

__________________
►I'm a devil on the run ♂
Jcxnet.com
*Keep It Simple **
  #3 (permalink)  
Antiguo 07/12/2008, 09:18
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Hola, yo me manejo con windows, pero no sé el servidor qué plataforma tiene, me parece que windows.
Podrías decirme, si no es mucha molestia, en cada caso cuál sería la solución, porque si bien me sirve para este caso uno, puede servirme el otro para más adelante.
Gracias
  #4 (permalink)  
Antiguo 07/12/2008, 12:26
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Formulario

En dado caso el parámetro correcto es:
Código php:
Ver original
  1. ini_set('sendmail_from','[email protected]');

Saludos.
  #5 (permalink)  
Antiguo 07/12/2008, 19:31
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Modifiqué las ' ' pero me sigue tirando este error:
Cita:
Parse error: syntax error, unexpected T_STRING in :\Inetpub\ftproot\sudominio\sendform.php on line 49
Y como les conté la linea 49 es la referida a un <div>
Tienen idea por qué puede ser?
  #6 (permalink)  
Antiguo 07/12/2008, 19:43
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Formulario

pues.. obviamente es un error de sintaxis, eso es claro....

ahora, porque no colocas las lineas donde crees esta el error ???
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #7 (permalink)  
Antiguo 08/12/2008, 07:43
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Había puesto todo arriba, por las dudas pongo la parte que compete al error, para cualquier consulta arriba está todo completo.
EN la línea 49 me dice que está el error
Código PHP:

40 ini_set
(sendmail_from,'[email protected]'); 
41 $from "From: Formulario desde la web$email\r\n"
42
43 mail
("[email protected]"$subject$message$from); 
44
45 ?>
 
46
47 <p>&nbsp;</p> 
48 <p>&nbsp;</p> 
49 <div align="center"> /*esta sería la linea 49 que me da error*/ 
50 <table border="0" id="table1" cellspacing="0" cellpadding="0" width="780"> 
51 <tr> 
  #8 (permalink)  
Antiguo 08/12/2008, 09:55
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Formulario

Mmmm estas seguro? Son todas las lineas? Si te fijas en el codigo original puse el nuevo resaltador y me indica que la 49 es otra linea..
  #9 (permalink)  
Antiguo 08/12/2008, 11:36
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Aquí va otra vez el código, cuando yo lo veo en la 49 me muestra lo que ya les comenté.
Código php:
Ver original
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  4. <title>Formulario</title>
  5. </head>
  6.  
  7. <SCRIPT language=JavaScript
  8. src="scriptsA.js"
  9. type=text/javascript></SCRIPT>
  10.  
  11. <body background="fondo2.gif">
  12. <?php
  13. if(!$email == "" && (!strstr($email,"@") || !strstr($email,".")))
  14. {
  15. echo "<h3></h3>\n";
  16. $badinput = "<h3>Su direccion electronica no es valida o esta mal escrita, reingresela por favor.</h3>\n";
  17. echo $badinput;
  18. }
  19.  
  20. $todayis = date("l, F j, Y, g:i a") ;
  21.  
  22. $asunto = $asunto ;
  23. $subject = $asunto;
  24.  
  25. $nota = stripcslashes($nota);
  26.  
  27. $message = " $todayis [EST] \n
  28. - ASUNTO: $asunto \n
  29. - ESCRIBE: $nombre ($email)\n
  30. - TITULO DEL MENSAJE: $asunto\n
  31. - MENSAJE:
  32. $nota \n
  33.  
  34.  
  35. ------------------------------------------------------------------------------------------------------------------------------------\n
  36. - INFORMACION ADICIONAL: IP = $ipi \n;
  37. - NAVEGADOR USADO: $httpagenti \n;
  38. - SE CONTACTO DESDE LA PAGINA: $httprefi \n;
  39.  
  40. ini_set('sendmail_from','[email protected]');
  41. $from = 'From: Contacto desde la Web $email\r\n';
  42.  
  43. mail('[email protected]', $subject, $message, $from);
  44.  
  45. ?>
  46.  
  47. <p>&nbsp;</p>
  48. <p>&nbsp;</p>
  49. <div align="center">
  50.     <table border="0" id="table1" cellspacing="0" cellpadding="0" width="780">
  51.         <tr>
  52.             <td width="70" height="344">
  53.             <p align="center">
  54.             <br>
  55.             <img border="0" src="dflateral.gif" width="70" height="139"><p align="center">
  56.             <br>
  57.             <font color="#FFFFFF">Home<br>
  58. &nbsp;</font><p align="center">&nbsp;</td>
  59.             <td><br>
  60. &nbsp;</td>
  61.             <td width="640" valign="bottom">
  62.             <table border="0" id="table2" cellspacing="0" cellpadding="0" height="399" width="769">
  63.                 <tr>
  64.                     <td height="15" width="203"></td>
  65.                     <td height="15" width="28"></td>
  66.                     <td height="15" width="5"></td>
  67.                     <td height="15" width="194"></td>
  68.                     <td height="15" width="5"></td>
  69.                     <td height="15" width="194" colspan="2"></td>
  70.                     <td height="15" width="140">
  71.                     <p align="center">
  72.                     <SCRIPT language=JavaScript type=text/javascript>
  73.                                     <!--   
  74.                                         escribir('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="120" HEIGHT="20" id="musica" ALIGN="">');
  75.                                         escribir('<param name="movie" value="musica.swf">');
  76.                                         escribir('<param name="quality" value="high">');
  77.                                         escribir('<embed src="musica.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" WIDTH="120" HEIGHT="20"></embed>');
  78.                                         escribir('</object>');
  79.                                     //-->
  80.                                   </SCRIPT>
  81.                     </td>
  82.                 </tr>
  83.                 <tr>
  84.                     <td height="20" width="203">&nbsp;</td>
  85.                     <td height="20" width="425" colspan="5" align="center">
  86.                     <form method="post" action="sendform.php" onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript" name="FrontPage_Form1">
  87.                     <p><font color="#FFFFFF" face="Arial">Confirmaci&#243;n de envío</font><p><br>
  88.        &nbsp;<b><font face="Tahoma" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#FFFFFF">Fecha:</strong><?php echo $todayis ?><strong>
  89. <br />
  90.         Remitente:</strong><?php echo $nombre ?>( <?php echo $email ?> )<strong>
  91.         </strong></font></font>
  92.         <p align="center"><font face="Tahoma" size="2"><strong>
  93.         <font size="2" face="Tahoma" color="#FFFFFF">Su Mensaje:<?php $notesout = str_replace("\r", "<br/>", $nota);echo $notesout; ?> </font>
  94.         </strong></font>
  95.         <p align="center"><font face="Tahoma" size="2">
  96.         <font size="2" face="Tahoma" color="#FFFFFF">
  97.         <strong>
  98. <br />
  99.         Su Direccion IP:<?php echo $ip ?> <br />
  100.         Referido desde:<?php echo $httpref ?> </font>  
  101. <p align="center"><a href="respuesta_ok.php" style="text-decoration: none">
  102. <font color="#FFFFFF" face="Tahoma" size="2">[CONFIRMAR]</font></a></td>
  103.                     <td height="20" width="71" align="center">
  104.                     &nbsp;</td>
  105.                     <td height="20" width="70" align="center">
  106.                     &nbsp;</td>
  107.                 </tr>
  108.                 <tr>
  109.                     <td height="20" width="203">&nbsp;</td>
  110.                     <td height="20" width="28">&nbsp;</td>
  111.                     <td height="20" width="5">&nbsp;</td>
  112.                     <td height="20" width="194">&nbsp;</td>
  113.                     <td height="20" width="5">&nbsp;</td>
  114.                     <td height="20" width="194" colspan="2">&nbsp;</td>
  115.                     <td height="20" valign="bottom" width="140">
  116.                     <img border="0" src="DA.gif" width="167" height="26"></td>
  117.                 </tr>
  118.             </table>
  119.             </td>
  120.         </tr>
  121.         </table>
  122. </div>

Qué bueno eso del resaltador, porque no sabía como hacer para que se vea la numeración.
Saludos

Última edición por GatorV; 08/12/2008 a las 11:46
  #10 (permalink)  
Antiguo 08/12/2008, 11:48
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Formulario

Si ves ya todo el código te falta cerrar la comilla en tu mail de contacto (en la linea 38).

Para usar el nuevo resaltador ve el primer tema del foro ahi explica como usarlo.

Saludos.
  #11 (permalink)  
Antiguo 08/12/2008, 12:23
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Hay algo que no entiendo, o no veo.
En la linea 38 me aparece
Código PHP:
SE CONTACTO DESDE LA PAGINA$httprefi n
a eso le tengo que colocar comillas?
El mail al que te referís que tengo que cerrar comillas lo tengo cerrado, salvo que existan diferencias entre la simple comilla(') que la doble ("), porque si te referís a las dobles, tendría que cambiarles.
Pero me parece raro que me tire otra línea donde no veo nada mal...
  #12 (permalink)  
Antiguo 08/12/2008, 12:24
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Formulario

Ve el resaltador y ve la linea 38, si te fijas ahi se termina lo que es tu email, ahi es donde debes de cerrar la cadena.

Saludos.
  #13 (permalink)  
Antiguo 12/12/2008, 10:55
 
Fecha de Ingreso: agosto-2007
Mensajes: 114
Antigüedad: 16 años, 8 meses
Puntos: 1
Respuesta: Formulario

Bien, hice lo que me dijiste, pero ahora me envía un error de sintaxis en la linea 40.
Help!
  #14 (permalink)  
Antiguo 12/12/2008, 11:00
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 17 años, 10 meses
Puntos: 2135
Respuesta: Formulario

Como te comento, debes de usar un editor que te haga chequeo de sintaxis, sin ver el código como lo tienes es imposible ahora saber que error te marca.

Saludos.
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:06.