I am upgrading some very old code to PHP 5.6 - I am having trouble getting the login form to work.
I have edited out as much superfluous code as I can to keep it simple but basically the present form looks like this:
<? if (isset($_POST["state"])){ //1 ?>
<form name="psinput" method="post" action="login.php">
<input type="text" name="pseudo">
<input type="password" name="password">
<input type="password" name="password2">
<input type="hidden" name="state" value="1">
<input type="image" name="imageField" src="../images/join_button.gif">
<? }
elseif ($state == 1) {
if ($password != $password2){
$errormess = "Your passwords do not match";
}
else if (strlen($pseudo) == 0){
$errormess = "Please enter a pseudonym";
}
else if ($pseudo == $password){
$errormess = "Your pseudonym cannot be the same as your password";
}
else if (strlen($password) == 0){
$errormess = "Please enter a pseudonym password";
}
}
And then there is a bunch of stuff that happens (insertion into the database etc) and if it all goes well it spits out the text:
print "Your pseudonym and password have been created<br><br>";
However when I hit the submit button on the form, it just returns the empty form to me again. I believe the problem to be with the way the state variable is being handled. I sincerely hope I have provided enough data for this question.