PHP/HTML Form not returning data

  • JakeBurgh
  • Newbie
  • Newbie
  • JakeBurgh
  • Posts: 5

Post 3+ Months Ago

Haven't coded for a good few years and having some issues getting back into it with some basic things. I haven't anywhere near finished this, but the issue I'm having is that the form isn't passing the data through to the handling page correctly.

This is the first input page:

PHP Code: [ 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>";


Which leads to this page, which checks that all fields have been entered/match up or something and if not, informs the user of the error and has another form to re-enter data. This works fine when coming from the above script, but then the following form (the one where incorrect data can be adjusted) does not pass any of the inputs through.

PHP Code: [ 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.   }


I'm sure it's something incredibly basic.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 54 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.