未定义的变量,即使它已定义

I've created a form of whom's action is my register PHP file.

In my register file, I have the code:

<?php
    if(isset($_POST['username']) && isset($_POST['password'])) {
        $username = $_POST['username'];
        $password - $_POST['password'];
        $price = 10;

        $custom = urlencode("{$username}|*|{$password}");
        $ppEmail = urlencode('myemail@email.com');
        $ppURL = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business={$ppEmail}&item_name=Buy Account&amount={$price}&currency_code=USD&button_subtype=products&custom={$custom}";

        header("location".$ppURL);
    } else {
        return null;
    }
?>

And on form submission, I'm getting this:

Notice: Undefined variable: password in C:\xampp\htdocs\incegister.php on line 4

Notice: Undefined variable: password in C:\xampp\htdocs\incegister.php on line 7

I can't figure out why :(

Anyone know?

change

$password - $_POST['password'];

to

$password = $_POST['password'];

You have made a typo in your code:

$password - $_POST['password'];

should be

$password = $_POST['password'];