<?php
$output = NULL;
$ip = $_SERVER['REMOTE_ADDR'];
if (isset($POST['submit'])) {
$username = $mysqli->real_escape_string($_post['username']);
$password = $mysqli->real_escape_string($_post['password']);
$rpassword = $mysqli->real_escape_string($_post['rpassword']);
$email = $mysqli->real_escape_string($_post['email']);
$query = $mysqli->query("SELECT * FROM users WHERE username = '$username'");
if (empty($username) OR empty($password) OR empty($email) or empty($rpassword)) {
$output = "Please fill in all fields!";
} elseif ($query->num_rows != 0) {
$output = "That username is already taken!";
} elseif ($rpassword != $password) {
$output = "Password does not match!";
}
}
?>
Later on in the script, I use this:
<?php
echo $output;
?>
It does not echo, and yes, I have added the mysqli query, but I removed it for the safety of the database. You can also see that it does not echo at the website: vobern.com
$outputis never set as you test againstisset($POST['submit'])which is always false, because thats a typo. Be sure to turn all error_reporting while in development mode. Do notePHPis case sensitive as well, so$_postis incorrect as well$outputtoNULLat the very top of the Script and he has no finalelseclause so this means that if all the 3 conditions in theconditional logicfail; the echo will always produce nothing since$outputisnull.if(isset($POST['submit'])){, so those three you are talking about are never reached in the first place