Reputation: 77
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'];
which retrieves the value from the 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>";
And received with
$assignmentName = $_GET['assignName'];
$isTeacher = $_GET['teacherYes'];
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!
Upvotes: 2
Views: 15311
Reputation: 28529
Use the &
between each url parameters
?assignName=$value2&teacherYes=$isTeacher
Upvotes: 2