I have the following code, where the var $username doesn't echo, when you type in a value.
//TODO: SET AUTH TOKEN as random hash, save in session
$auth_token = rand();
if (isset($_POST['action']) && $_POST['action'] == 'Login')
{
$errors = array(); //USED TO BUILD UP ARRAY OF ERRORS WHICH ARE THEN ECHOED
$username = $_POST['username'];
if ($username = '')
{
$errors['username'] = 'Username is required';
}
echo $username; // var_dump($username) returns string 0
}
require_once 'login_form.html.php';
?>
login_form şudur:
<form method="POST" action="">
<input type="hidden" name="auth_token" value="<?php echo $auth_token ?>">
Username: <input type="text" name="username">
Password: <input type="password" name="password1">
<input type="submit" name="action" value="Login">
</form>
Ben kullanıcı adı metin kutusuna bir değer yazın ve giriş tuşuna sadece zaman auth belirteç parçası önemli değil, o, adı alışkanlık (0) dize döndürür ve print_r sadece boş var_dump, echo.