-2

I have attendance management system in which two tables attendance and employees. In this system a page that display all names of employees and make this as hyperlink shown below

<?php echo "<a href='attendance_add.php'>" . $row['emp_name'] . "</a> "; ?>

But I want to send employee_id to attendance_add.php page. So how can i send?

  • 2
    Possible duplicate of [PHP Pass variable to next page](http://stackoverflow.com/questions/871858/php-pass-variable-to-next-page) – kunicmarko20 Mar 30 '16 at 16:31

2 Answers2

1

You would do something like :

<?php echo "<a href='attendance_add.php?id=".$row['employee_id']."'>" . $row['emp_name'] . "</a> "; ?>

and then you will catch id from url with $_GET['id'] inside of attendance_add.php

kunicmarko20
  • 2,095
  • 2
  • 15
  • 25
0

in a href you write this:

<?php echo "<a href="product.php?id=<?php echo $id?> ">VIEW</a>"; ?>

then, you can fitch id on the new page with it:

$link = explode("=", $_SERVER['REQUEST_URI']);
$id = array_pop($link);

or using GET SUPERGLOBAL:

$_GET['id'];
Xab Ion
  • 1,105
  • 1
  • 11
  • 20