我一直在玩这个想法,我回显一个链接,它会根据我从数据库中得到的字符串而变化。(GET 命令)
这是我一直在使用的代码:
<?php echo '<a href="submittoplay.php?username="' . ($username) . ">";?>
我希望回声的输出看起来像这样,其中$username = bob
<a href="submittoplay.php?username=bob
或在地址栏中,当我单击要submittoplay.php?username=bob
的链接
但是当我运行代码时,只有"<a href="submittoplay.php?=username"
显示。它似乎不想将我从数据库中收集的字符串插入回显链接。
我知道$username是一个有效的字符串,我测试了它并得到了我正在寻找的结果。
任何帮助将不胜感激!
谢谢!
这里是:--
$username='bob';
echo '<a href="submittoplay.php?user='.$username . '">User link</a>';
在 php 中
$user_name='sample';
echo '<a href="submittoplay.php?user='.$user_name. '">Your link</a>';
小提琴链接
在菲律宾语之外
<a href="submittoplay.php?user=<?php echo $user_name;?>">Your link</a>
小提琴链接