I have made a registration page for my login. Whether I enter matching password or not matching passwords it still says they don't match. I can't figure out whats wrong. Can anybody else? <?php //get form info $firstname=$_POST["firstname"]; $lastname=$_POST["lastname"]; $username=$_POST["username"]; $password=$_POST["password"]; $confirmppassword=$_POST["confirmpassword"]; $emailaddress=$_POST["emailaddress"]; $secretquestion=$_POST["secretquestion"]; $secretanswer=$_POST["secretanswer"]; //make variables some encrypt $cpass = md5($password); $cuser = md5($username); $csecretanswer = md5($secretanswer); $file = "users/" . $user . ".php"; $data = "<?php $cpass=" . $cpass . "; $cuser=" . $cuser . "; $firstname=" . $firstname . "; $lastname=" . $lastname . "; $secretquestion=" . $secretquestion . "; $csecretanswer=" . $csecretanswer . " ?>"; //make sure all info is ok if ($password!=$confirmpassword) { echo "Your passwords do not match. <a href=\"register2.htm\">Try Again</a><br>"; exit(0); } if (file_exists($file)) { echo "Username is in use. <a href=\"register2.htm\">Try Again</a><br>"; exit(0); } //make users file $handle = fopen($file); fwrite($handle, $data); fclose($handle); head ( 'location: index.htm' ); ?> PHP:
also, you have a typo in the line: $confirmppassword=$_POST["confirmpassword"]; should be $confirmpassword=$_POST["confirmpassword"];
I found the error. It was just a typo. the only problem is im still getting this What exactly does it mean?
Ahhh.... That's not head() you have to use there.. You're thinking about header header( 'Location: index.htm' ); PHP: