Reputation: 1
What I have been trying to do is this. I created two files student_log.php and stu_det.php.Now I want to pass the student's roll no from student_log.php to stu_det .php And I used this code:
<a href="stu_det.php? PID=<? php echo $ rno;>">details </a>
How do I retrieve this value in stu_det.php?
Upvotes: 0
Views: 43
Reputation: 46900
First of all remove the extra space from your link, (seems like you have a few of them) .
<a href="stu_det.php?PID=<?php echo $rno;?>">
^
Then in your stu_det.php
you can simply fetch the value with
$value=$_GET["PID"];
That's the very basic way to get query string values. However you should add a check whether the value exists before you try to fetch it. That is like
if(isset($_GET["PID"]))
{
$value=$_GET["PID"];
}
else
{
echo "No PID value was received";
}
Upvotes: 3
Reputation: 2014
Look after the spaces in query string
<a href="stu_det.php?PID=<?php echo $rno; ?>">details </a>
Upvotes: 0