-4

I have an email address passed as a variable in the url as part of the link. I need to be able to retrieve this email address and then insert it into a database. the issue is i cannot seem to be able to retrieve the email address from the url. This is the code Im using to get it:

if(isset($GET['email'])){
 $email = $_GET['email'];
 }

The url looks something like this www.sumwebsite.com?email=aemail@email.com Any ideas? As far as I have been able to see my code is right, so I am at a complete loss as to why it is not working.

4

2 回答 2

1
if(isset($GET['email'])){
          ^-- missing a _

应该

if(isset($_GET['email'])){
          ^---note the _
于 2013-06-24T21:42:36.437 回答
-1

当您使用电子邮件创建链接时,您应该对其进行urlencode()。当您使用$_GET从 PHP 获取它时,您应该使用urldecode()它。

编辑

正如评论中所说,$_GET 已经透明地运行 urldecode(),所以不需要它。确实需要 urlencode()。此外,作者犯了使用 $GET 而不是 $_GET 的错误。

于 2013-06-24T21:41:50.383 回答