How to pass variables between 2 PHP files?

Viewed 5496

I have the following code in a file called one.php

<?php
session_start();
$_SESSION['one'] = "ONE";
$_SESSION['two'] = "TWO";
?>

<html>
<body>
<a href="two.php">Click here for 1.</a>
<a href="two.php">Click here for 2.</a>
</body>
</html>

Now when I click on one of the anchor tag links, it takes me to two.php.

Here I want the output to be,

One was clicked. OR Two was clicked.

How do I make the above output in two.php using PHP?

4 Answers
Related