Tengo un formulario de correo en php que no me va. Como no sé programar en PHP básicamente me he limitado a cambiar los aspectos que no me interesaban de un formulario ya hecho. Este formulario consta de dos archivos contact_form.php y result_form.php (que es el que envía el mail).
Después de hacer muchísimas pruebas me doy cuenta de que lo que ocurre es que después de rellenar los campos y darle a Enviar, el formulario no recoge las variables, por lo que siempre me comunica con la página de error que indica que rellenemos los campos importantes del formulario. Probé a eliminar del result_form.php la parte en la que se analiza si las variables están vacías y de esa forma el correo se envía al destinatario, pero llega vacío, sin los datos escritos en el formulario.
He estado hablando con el servicio técnico del servidor pero, como de costumbre, sólo te dicen lo que ya sabes.
Por otro lado ese mismo formulario lo utilizo correctamente en otra web del mismo servidor sin problemas.
¿A qué puede deberse este problema con las variables?
Incluyo el código de los dos archivos:
contact_form.php:
Código :
<BODY BGCOLOR="#FFFFFF" text="#000000"> <center> <TABLE border=0 cellPadding=0 cellSpacing=5 width=100%> <TR> <TD bgColor=#666666 valign=center> <FONT color=#ffffff> <CENTER> <B>Contact Form</B> </FONT> </CENTER> </TD> </TR> <TR> <td> <form action="result_form.php" method="post"> <table align="center"> <tr> <td align=right><B>Your Name:</td> <td><input name="name" size=30 ></td> </tr> <tr> <td align=right><B>Your E-Mail:</td> <td><input name="email" size=30 ></td> </tr> <tr> <td align=right>Ciudad</td> <td><input name="ciudad" size=30 value=""></td> </tr> <tr> <td align=right><B>Your Company:</td> <td><input name="company" size=30 value=""></td> </tr> <tr> <td colspan=2 align="center"><B>Comments/Infos:<BR> <textarea name="comments" cols=50 rows=10 wrap=soft></textarea></td> </tr> <tr> <td></td> <td> <BR> <input type="submit" value="Send"> <input type="reset" value="ReFill"> </td> </tr> </table> <? ################# CHECKING IP ADRESS ########### Sonntag, 18. Februar 2001 echo "<input type=hidden name=ipadress value=$REMOTE_ADDR>"; echo "<input type=hidden name=referer value=$HTTP_REFERER>"; ?> </form> </TD> </TR> <TR> <TD bgColor=#666666 vAlign=center height="15"> <FONT color=#ffffff> <CENTER> <B> <? $today = getdate(); $month = $today[month]; $mday = $today[mday]; $year = $today[year]; echo "$month $mday, $year"; ?> </B> </FONT> </CENTER> </TD> <TR> <!-- PLEASE DO NOT REMOVE THIS TAG -----------------------------------------> <TD align="center"><span class="link">Easycontact 1.1, Copyright by <A HREF="http://www.NemeziZ.net" target="_blank">NemeziZ</A> ©</TD> <!-- PLEASE DO NOT REMOVE THIS TAG -----------------------------------------> </TR> </TR> </TABLE> </center> </BODY>
result_form.php:
Código :
<BODY BGCOLOR="#FFFFFF" text="#000000"> <CENTER> <TABLE WIDTH="100%" BGCOLOR="666666" CELLSPACING=0 CELLPADDING=0 VALIGN=CENTER BORDER=0> <TR> <TD> <CENTER> <? ########################### # Configuration # ##################################################### $site_name = "miweb.com"; # Put here your Sitename or Company $site_email = "[email protected]"; # Put here your E-Mail adress ##################################################### ##################################################### # This below is the Information which will be sent to the customer ##################################################### echo "<font color=white><B>Successfully transmitted</B></font></td></tr></table>"; ##################################################### # !!!Please do not change anything below this line. ##################################################### PRINT "<CENTER>"; PRINT "<P><BR>Thank you $name for your Submission.<BR>You will be contacted by $site_name.<BR>"; PRINT "</CENTER>"; mail("$email", "Thanks from $site_name!", "$namen Your sumbmitted comments or question will be answered within 3 days. If not so, please email to $site_email ____________________________________________________________ You Submitted following informations: Email: $email Ciudad: $ciudad Company: $company Comments: $Comments ____________________________________________________________"); ####################################################### # This below is the information which will # be sent to the Administrator ####################################################### mail("$site_email", "$site_name Contact Form", "Submitted By: $name ____________________________________________________________ Email: $email Ciudad: $ciudad Company: $company Comments: $Comments Userinfos Sender: $ipadress Referer: $referer ____________________________________________________________"); ?> </center> <!-- PLEASE DO NOT REMOVE THIS TAG -----------------------------------------> <script src="http://216.221.180.170/cgi-bin/logitpro/logitpro.cgi?java"></script> <!-- PLEASE DO NOT REMOVE THIS TAG -----------------------------------------> </BODY>