I want to pass some PHP variables using the URL.
I tried the following code:
link.php
In your link.php your echo statement must be like this:
echo 'Link 2';
Then in your pass.php you cannot use $a because it was not initialized with your intended string value.
You can directly compare it to a string like this:
if($_GET['link'] == 'Link1')
Another way is to initialize the variable first to the same thing you did with link.php. And, a much better way is to include the $a and $b variables in a single PHP file, then include that in all pages where you are going to use those variables as Tim Cooper mention on his post. You can also include this in a session.