douliao2493 2014-04-29 12:07
浏览 134
已采纳

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

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?

  • 写回答

2条回答 默认 最新

  • douna1892 2014-04-29 12:08
    关注

    change

    $password - $_POST['password'];
    

    to

    $password = $_POST['password'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器