在< a href>中传递多个变量使用PHP和$ _GET [''] [英] Passing multiple variables in <a href> using PHP and $_GET['']
问题描述
我正在使用PHP根据变量创建链接.目前,我已经使用了这一行代码,并且已经多次使用并且运行良好.
I'm using PHP to create a link depending on a variable. Currently I have this line of code which I have used multiple times and works perfectly.
echo "<a href='specificAssignmentPage.php?
assignName=$value2'>$value2</a>";
以上全部一行.在接收页面上,我有
The above is all on one line. On the receiving page I have
$assignmentName = $_GET['assignName'];
从URL检索值.
但是我想通过我尝试过的链接传递多个变量
However I want to pass multiple variables through the link which I've attempted with
echo "<a href='specificAssignmentPage.php?assignName=$value2'teacherYes=$isTeacher>$value2</a>";
并通过
$assignmentName = $_GET['assignName'];
$isTeacher = $_GET['teacherYes'];
我收到此错误:注意:未定义的索引:教师在第13行的/Applications/XAMPP/xamppfiles/htdocs/Quests/specificAssignmentPage.php中是
I get this error: " Notice: Undefined index: teacherYes in /Applications/XAMPP/xamppfiles/htdocs/Quests/specificAssignmentPage.php on line 13"
我知道分隔语句可能是一个基本的语法错误,但是我非常感谢您的帮助.谢谢!
I know that it's probably a basic syntax error with separating my statement but I would really appreciate some help. Thanks!
推荐答案
在每个网址参数之间使用&
Use the &
between each url parameters
?assignName=$value2&teacherYes=$isTeacher
这篇关于在< a href>中传递多个变量使用PHP和$ _GET ['']的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!