Php 无法从$\u获取

Php 无法从$\u获取,php,Php,我无法从index.php到profile.php获取id。我已经尝试了Stackoverflow的一些解决方案,但似乎都不起作用 index.php: $id = getfield('id'); //getfield is a function that pulls out the fields <a class="profile" href="profile.php?=<?php echo $id.' ">'.ucfirst ($firstname);?></

我无法从
index.php
profile.php
获取id。我已经尝试了Stackoverflow的一些解决方案,但似乎都不起作用

index.php:

$id = getfield('id'); //getfield is a function that pulls out the fields

<a class="profile" href="profile.php?=<?php echo $id.' ">'.ucfirst ($firstname);?></a>
输出为
无法获取id
。 我需要回显身份证。
我不知道我做错了什么,如果有人能帮我找到正确的方向,我将不胜感激。

您的url外观中没有设置任何内容:

<a class="profile" href="profile.php?=<?php echo $id.' ">'.ucfirst ($firstname);?></a>
                                    ^

^
应该是

<a class="profile" href="profile.php?id=<?php echo $id.' ">'.ucfirst ($firstname);?></a>
                                     ^

^

您没有在url外观中设置任何内容:

<a class="profile" href="profile.php?=<?php echo $id.' ">'.ucfirst ($firstname);?></a>
                                    ^

^
应该是

<a class="profile" href="profile.php?id=<?php echo $id.' ">'.ucfirst ($firstname);?></a>
                                     ^

^


index.php中的Jake您在哪里声明/定义变量$id?请稍等,让我来编辑它您的href在这里应该看起来像
profile.php?id=id_
您当前没有将id设置为任何内容这就是我的浏览器url的样子
/profile.php?=2
查看我的答案。你没有设置
id
变量你只是在你的url末尾有一个随机的
=2
在index.php中jake你在哪里声明/定义变量$id?等一下让我编辑它你的href应该看起来像
profile.php?id=id\u这里
你当前没有将id设置为任何东西这就是我的浏览器url的样子比如
/profile.php?=2
看看我的答案。你没有设置
id
变量,你只是在你的URL末尾有一个随机的
=2
,别忘了接受答案,这样其他人可能会在他们需要的时候发现这一点。我被困在这几个小时了,我不敢相信这是多么简单,如果不是你,我永远都不会得到正确的答案。欢迎你,快乐编码!你也可以投票表决答案!:)我只有3次重复,但我会尽快将其标记为正确。别忘了接受答案,这样其他人可能会发现,如果他们需要的话。我在这个问题上坚持了好几个小时,我不敢相信这有多简单。如果没有你,我永远不会正确。不客气,编码快乐!你也可以投票表决答案!:)我只有3次重复,但我会尽快将其标记为正确