Comunidad de diseño web y desarrollo en internet online

Problema con Formulario PHP

Citar            
MensajeEscrito el 02 Oct 2008 08:54 am
Buenas!
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> &copy;</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>

Por robin_blood

13 de clabLevel



 

msie7
Citar            
MensajeEscrito el 08 Oct 2008 07:55 am
Please ayuda!

Por robin_blood

13 de clabLevel



 

msie7
Citar            
MensajeEscrito el 08 Oct 2008 11:40 am
Estas asumiendo que register_globals están en On, cosa que nunca deberias asumir y te recomendaría trabajar con register_globals en Off siempre. La solución:

Código :

$name = $_POST["name"];
$email = $_POST["email"];
$ciudad = $_POST["ciudad"];
$company = $_POST["company"];
$comments = $_POST["comments"];


Coloca justo debajo de esto en result_form.php::

Código :

###########################
#     Configuration       #
#####################################################
   $site_name = "miweb.com";              # Put here your Sitename or Company
   $site_email = "[email protected]";            # Put here your E-Mail adress
#####################################################


Otro cosa, cambia las etiquetas de apertura corta por la tradicional, me refiero a estas <? por esta <?php.

Saludos

Por Maikel

BOFH

5575 de clabLevel

22 tutoriales
5 articulos

Genero:Masculino   Team Cristalab

Claber de baja indefinida

firefox
Citar            
MensajeEscrito el 12 Oct 2008 10:29 am
Ey!!! sí... parece que funciona. Aún tengo que arreglar un par de cosillas pero parece que va bien. Muchísimas gracias!

Por robin_blood

13 de clabLevel



 

firefox

 

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