VARIABLE, but it's not unexpected

I'm getting an error:

Parse error: syntax error, unexpected T_VARIABLE in home2/chippery/public_html/login/text/loginStuff.php on line 4

Line 4:

$pass = $_POST['password']

However, line 3 works fine:

$user = $_POST['username']

Post is from:

<html>
<form action='loginStuff.php' method='POST'>
User: <input type='text' name='username'><br>
Pass: <input type='password' name='password'><br>
<input type='submit' value='Log In'>
</form>
</html>

I just got into PHP (less than an hour ago) so I'm sure it's a stupid mistake, but can you figure out what's wrong?


每行末尾需要分号。


End conditions/variable assignments/manupulations with a semicolon ;

Example:

$Username = $_POST['Username']; // Solution
$Password = $_POST['Password']; // Solution
$Username = trim($_POST['Username']); // Example only 

But not for if statements:

if (isset($_POST['Username'])){
   if (isset($_POST['Username'])){
     $Username = $_POST['Username'];
   }
} // No semi colon needed here, only inside the braces
链接地址: http://www.djcxy.com/p/69232.html

上一篇: 意想不到的'其他'(T

下一篇: VARIABLE,但这并不意外