title: How to pass a PHP variable using the URL
body: <p>I want to pass some PHP variables using the URL.</p>
  
  <p>I tried the following code:</p>
  
  <p>link.php </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;?php
  $a='Link1';
  $b='Link2';
  echo '&lt;a href="pass.php?link=$a"&gt;Link 1&lt;/a&gt;';
  echo '&lt;br/&gt;';
  echo '&lt;a href="pass.php?link=$b"&gt;Link 2&lt;/a&gt;';
  ?&gt;&lt;/body&gt;&lt;/html&gt;`&lt;/pre&gt;&lt;/code&gt;
  
  pass.php
  &lt;pre&gt;&lt;code&gt;`&lt;html&gt;
  &lt;body&gt;
  &lt;?php
  if ($_GET['link']==$a)
  {
  echo "Link 1 Clicked";
  } else {
  echo "Link 2 Clicked";
  }
  ?&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>Upon clicking the links <code>Link1</code> and <code>Link2</code>, I get "Link 2 clicked". Why?</p>