title: How to put a link passing variable inside php echo
body: <p>I have a link that passes variable to another page but I want to display that link only on some condition so how to place it inside <code>php</code> code.</p>
  
  <pre><code>&lt;a href="page2.php?Id=&lt;?php echo $Id; ?&gt;"&gt;Product&lt;/a&gt; 
  
  &lt;?php
  echo '&lt;a href="page2.php?Id=&lt;?php echo $Id; ?&gt;"&gt;Product&lt;/a&gt;';
  ?&gt;
  </code></pre>
  
  <p>This doesn't work.</p>