Simple register script, PLEASE help, its not that simple!

Hi can someone pls help, im tryin a tutorial but keep getting errors, this is the first one i get after registering.

You Are Registered And Can Now Login
Warning: Cannot modify header information - headers already sent by (output started at /home/aretheyh/public_html/nealeweb.com/regcheck.php:43) in /home/aretheyh/public_html/nealeweb.com/regcheck.php on line 46

i believe you are displaying the “You Are Registered And Can Now Login” first and then trying to use the script line like header(“location: somepage”);

isn’t this the case? if it is, the solution is simple,

you should not have any html content / output / php script that echos something / not even blank spaces
before the header(“locaton:”) line…

its that simple!!

That sounds like whats happening, can i pm you the script so you could fix it for me pls?

Please, someone help me!

pm me the script, i can help you.

i found the problem, it’s the very same i was talking about…

[php]
else
{
echo “You Are Registered And Can Now Login”;
$formUsername = $username;
header (‘location: Login.php’);
}
[/php]

in the above piece of code from your script, there is an echo statement before the header(“Location:login.php”); line. There should not be any output before header(“Location”) statement.

Instead what you can do is…

[php]
else
{

            header ('location: Login.php&user='.$username.'&status='fail');
        }

[/php]

here, when login fails, i am redirecting to the login page with two parameters one is user name and the other is login status as fail. so on the login page, you can catch these get parameters and display the error message accordingly.

again, there should not by any output before header statement.

Regards,

Sponsor our Newsletter | Privacy Policy | Terms of Service