PHP / HTML forma no devolver datos
- JakeBurgh
- Newbie


- Registrado: Sep 05, 2010
- Mensajes: 5
- Status: Offline
¿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:
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.
Estoy seguro es algo muy básico.
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>";
<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>";
- 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>";
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>";
}
{
$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>";
}
- 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>";
- }
Estoy seguro es algo muy básico.
- Anonymous
- Bot


- Registrado: 25 Feb 2008
- Mensajes: ?
- Loc: Ozzuland
- Status: Online
Mayo 22nd, 2011, 11:39 am
Página 1 de 1
Para responder a este tema que necesita para ingresar o registrarse. Es gratis.
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
