PHP / HTML forma no devolver datos

  • JakeBurgh
  • Newbie
  • Newbie
  • No Avatar
  • Registrado: Sep 05, 2010
  • Mensajes: 5
  • Status: Offline

Nota Mayo 22nd, 2011, 11:39 am

¿No han codificado para un par de años buenos y teniendo algunos problemas para volver a él con algunas cosas básicas. No he terminado ni de lejos, pero la cuestión estoy teniendo es que el formulario no está pasando los datos a través de la página de la manipulación correcta.

Esta es la página de la primera entrada:

PHP Código: [ Select ]
print "<center>Please complete the following form, those with an astrix are required.<br /> The others are optional and will be visible to other members if you choose to enter details.<br /><br />
 
<center><table><tr><td><form action='register2.php' method=post>
<tr><td>First Name* </td><td><input type=text name='firstname'></td></tr>
<tr><td>Surname* </td><td><input type=text name='surname'></td></tr>
<tr><td>Email Address* </td><td><input type=text name=email1 size=40></td></tr>
<tr><td>Confirm Email Address* </td><td><input type=text name=email2 size=40></td></tr>
<tr><td>Password* </td><td><input type=password name=password1></td></tr>
<tr><td>Confirm Password* </td><td><input type=password name=password2></td></tr></td><td>
<tr><td>Profile</td><td><textarea cols=40 rows=4 name=profile></textarea></td></tr>
<tr><td>Age</td><td><input type=text size=8 name=age></td></tr>
<tr><td>Favourite Football Team</td><td><input type=text name=footballteam></td></tr></td></tr></td></tr></table>";
print "<br /><br /><input type=submit value='Continue'>";
print "</form>";
  1. print "<center>Please complete the following form, those with an astrix are required.<br /> The others are optional and will be visible to other members if you choose to enter details.<br /><br />
  2.  
  3. <center><table><tr><td><form action='register2.php' method=post>
  4. <tr><td>First Name* </td><td><input type=text name='firstname'></td></tr>
  5. <tr><td>Surname* </td><td><input type=text name='surname'></td></tr>
  6. <tr><td>Email Address* </td><td><input type=text name=email1 size=40></td></tr>
  7. <tr><td>Confirm Email Address* </td><td><input type=text name=email2 size=40></td></tr>
  8. <tr><td>Password* </td><td><input type=password name=password1></td></tr>
  9. <tr><td>Confirm Password* </td><td><input type=password name=password2></td></tr></td><td>
  10. <tr><td>Profile</td><td><textarea cols=40 rows=4 name=profile></textarea></td></tr>
  11. <tr><td>Age</td><td><input type=text size=8 name=age></td></tr>
  12. <tr><td>Favourite Football Team</td><td><input type=text name=footballteam></td></tr></td></tr></td></tr></table>";
  13. print "<br /><br /><input type=submit value='Continue'>";
  14. print "</form>";


Lo que nos lleva a esta página, que comprueba que todos los campos han sido introducidos / partido o algo y si no, informa al usuario del error y tiene otra forma de volver a introducir los datos. Esto funciona bien cuando viene de la secuencia de comandos, pero luego la siguiente forma (en la que los datos incorrectos puede ser ajustado) no pasa a cualquiera de las entradas a través.

PHP Código: [ Select ]
if (!$_POST['firstname'])
 {
 $error1='<br /><font color=red><i>You have not entered your name!</i></font>';
 }
 else
 {
 $error1=1;
 }
 if (!$_POST['surname'])
 {
 $error2='<br /><font color=red><i>You have not entered your name!</i></font>';
 }
  else
 {
 $error2=1;
 }
 if (!$_POST['email1'])
 {
 $error3='<br /><font color=red><i>You have not entered your email address!</i></font>';
 }
  else
 {
 $error3=1;
 }
 if (!$_POST['email2'])
 {
 $error4='<br /><font color=red><i>You did not confirm your email address!</i></font>';
 }
  else
 {
 $error4=1;
 }
 if ($error3==1 AND $error4==1 AND $_POST['email1'] != $_POST['email2'])
 {
 $error3='<br /><font color=red><i>Your email addresses do not match!</font></i>';
 }
 if (!$_POST['password1'])
 {
 $error5='<br /><font color=red><i>You have not entered a password!</i></font>';
 }
  else
 {
 $error5=1;
 }
 if (!$_POST['password2'])
 {
 $error6='<br /><font color=red><i>You did not confirm your password!</i></font>';
 }
  else
 {
 $error6=1;
 }
 if ($error5==1 AND $error6==1 AND $_POST['password1'] != $_POST['password2'])
 {
 $error5='<br /><font color=red><i>Your passwords do not match!</font></i>';
 }
 
 if ($error1 != 1 OR $error2 != 1 OR $error3 != 1 OR $error4 != 1 OR $error5 != 1 OR $error6 != 1)
 {
 print "<center>Please complete the following form, those with an astrix are required.<br /> The others are optional and will be visible to other members if you choose to enter details.<br /><br />
 
 
<center><table><tr><td><form action='register2.php' method=post>
<tr><td>First Name* {$error1} </td><td><input type=text name='firstname' value='{$_POST['firstname']}'></td></tr>
<tr><td>Surname* {$error2} </td><td><input type=text name='surname' value='{$_POST['surname']}'></td></tr>
<tr><td>Email Address* {$error3} </td><td><input type=text name=email1 size=40 value='{$_POST['email1']}'></td></tr>
<tr><td>Confirm Email Address* {$error4}
</td><td><input type=text name=email2 size=40 value='{$_POST['email2']}'></td></tr>
<tr><td>Password* {$error5} </td><td><input type=password name=password1></td></tr>
<tr><td>Confirm Password* {$error6} </td><td><input type=password name=password2></td></tr></td><td>
<tr><td>Profile</td><td><textarea cols=40 rows=4 name=profile value='{$_POST['profile']}'></textarea></td></tr>
<tr><td>Age</td><td><input type=text size=8 name=age value='{$_POST['age']}'></td></tr>
<tr><td>Favourite Football Team</td><td><input type=text name=footballteam value='{$_POST['footballteam']}'></td></tr></td></tr></td></tr></table>";
print "<br /><br /><input type=submit value='Continue'>";
print "</form>";
  }
  1. if (!$_POST['firstname'])
  2.  {
  3.  $error1='<br /><font color=red><i>You have not entered your name!</i></font>';
  4.  }
  5.  else
  6.  {
  7.  $error1=1;
  8.  }
  9.  if (!$_POST['surname'])
  10.  {
  11.  $error2='<br /><font color=red><i>You have not entered your name!</i></font>';
  12.  }
  13.   else
  14.  {
  15.  $error2=1;
  16.  }
  17.  if (!$_POST['email1'])
  18.  {
  19.  $error3='<br /><font color=red><i>You have not entered your email address!</i></font>';
  20.  }
  21.   else
  22.  {
  23.  $error3=1;
  24.  }
  25.  if (!$_POST['email2'])
  26.  {
  27.  $error4='<br /><font color=red><i>You did not confirm your email address!</i></font>';
  28.  }
  29.   else
  30.  {
  31.  $error4=1;
  32.  }
  33.  if ($error3==1 AND $error4==1 AND $_POST['email1'] != $_POST['email2'])
  34.  {
  35.  $error3='<br /><font color=red><i>Your email addresses do not match!</font></i>';
  36.  }
  37.  if (!$_POST['password1'])
  38.  {
  39.  $error5='<br /><font color=red><i>You have not entered a password!</i></font>';
  40.  }
  41.   else
  42.  {
  43.  $error5=1;
  44.  }
  45.  if (!$_POST['password2'])
  46.  {
  47.  $error6='<br /><font color=red><i>You did not confirm your password!</i></font>';
  48.  }
  49.   else
  50.  {
  51.  $error6=1;
  52.  }
  53.  if ($error5==1 AND $error6==1 AND $_POST['password1'] != $_POST['password2'])
  54.  {
  55.  $error5='<br /><font color=red><i>Your passwords do not match!</font></i>';
  56.  }
  57.  
  58.  if ($error1 != 1 OR $error2 != 1 OR $error3 != 1 OR $error4 != 1 OR $error5 != 1 OR $error6 != 1)
  59.  {
  60.  print "<center>Please complete the following form, those with an astrix are required.<br /> The others are optional and will be visible to other members if you choose to enter details.<br /><br />
  61.  
  62.  
  63. <center><table><tr><td><form action='register2.php' method=post>
  64. <tr><td>First Name* {$error1} </td><td><input type=text name='firstname' value='{$_POST['firstname']}'></td></tr>
  65. <tr><td>Surname* {$error2} </td><td><input type=text name='surname' value='{$_POST['surname']}'></td></tr>
  66. <tr><td>Email Address* {$error3} </td><td><input type=text name=email1 size=40 value='{$_POST['email1']}'></td></tr>
  67. <tr><td>Confirm Email Address* {$error4}
  68. </td><td><input type=text name=email2 size=40 value='{$_POST['email2']}'></td></tr>
  69. <tr><td>Password* {$error5} </td><td><input type=password name=password1></td></tr>
  70. <tr><td>Confirm Password* {$error6} </td><td><input type=password name=password2></td></tr></td><td>
  71. <tr><td>Profile</td><td><textarea cols=40 rows=4 name=profile value='{$_POST['profile']}'></textarea></td></tr>
  72. <tr><td>Age</td><td><input type=text size=8 name=age value='{$_POST['age']}'></td></tr>
  73. <tr><td>Favourite Football Team</td><td><input type=text name=footballteam value='{$_POST['footballteam']}'></td></tr></td></tr></td></tr></table>";
  74. print "<br /><br /><input type=submit value='Continue'>";
  75. print "</form>";
  76.   }


Estoy seguro es algo muy básico.
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Mayo 22nd, 2011, 11:39 am

Publicar Información

  • Total de mensajes en este tema: 1 mensaje
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 125 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC