-2

assume we click on a link in page page1.php?id=1 and go to page2.php. My question is that: How can I retrieve value of id on page1.php in page2.php?

Ehsan
  • 2,273
  • 8
  • 36
  • 70
  • You can't get `id` of previous page. One alternativa is that your page1 links to `page2?id=1` so you have the id also available on `page2` – Gerardo Grignoli Aug 19 '16 at 18:18

1 Answers1

2

In page1.php set the id value in a $_SESSION['pageid']=$_GET['id']

den retrive $_SESSION['pageid'] in page2.php and as soon as u access the id value unset the session unset($_SESSION['pageid'])

Achyut Kr Deka
  • 739
  • 1
  • 8
  • 18