我创建了一个表单,其中的操作是我的注册PHP文件.
在我的注册文件中,我有代码:
<?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}¤cy_code=USD&button_subtype=products&custom={$custom}";
header("location".$ppURL);
} else {
return null;
}
?>
Run Code Online (Sandbox Code Playgroud)
在表单提交上,我得到了这个:
Notice: Undefined variable: password in C:\xampp\htdocs\inc\register.php on line 4
Notice: Undefined variable: password in C:\xampp\htdocs\inc\register.php on line 7
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚为什么:(
谁知道?
更改
$password - $_POST['password'];
Run Code Online (Sandbox Code Playgroud)
至
$password = $_POST['password'];
Run Code Online (Sandbox Code Playgroud)