【问题标题】:Form submit redirection using header with variable included使用包含变量的标头表单提交重定向
【发布时间】:2014-03-03 17:28:57
【问题描述】:

我有一个表单可以发布到此页面上的另一个页面,它处理表单并重定向我,但我想要做的是向 url 添加一个变量

重定向我的行

header('Location: landing.php?url=$url');

你看到我试图去landing.php?url=the-domain-thats-entered-into-the-form

它不起作用,但如果我删除上面的行并将以下内容放在代码后面

<?  echo "$url"; ?>

它显示得很好,这让我认为我缺少一些基本的东西

【问题讨论】:

    标签: php forms redirect


    【解决方案1】:

    单引号下的变量不会被解析。试试这样[改用双引号]

    header("Location: landing.php?url=$url");
           ^---  Use Double Quotes   -----^
    

    【讨论】:

      猜你喜欢
      • 2015-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-13
      • 2021-02-15
      • 2011-12-26
      相关资源
      最近更新 更多