0

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?

Tamil Selvan C
  • 19,913
  • 12
  • 49
  • 70

2 Answers2

3

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";
}
Hanky Panky
  • 46,730
  • 8
  • 72
  • 95
0

Look after the spaces in query string

<a href="stu_det.php?PID=<?php echo $rno; ?>">details </a>
Muhammad Ali
  • 1,992
  • 1
  • 13
  • 20