title: Injecting PHP URL variable into HTML
body: <p>Trying to inject HTML into PHP code to allow the creation of dynamic sharing links on my site. </p>
  
  <p>I have attempted the code below, but it's resulting in an error</p>
  
  <pre><code>&lt;?php 
  // Program to display URL of current page. 
  
  if(isset($_SERVER['HTTPS']) &amp;&amp; $_SERVER['HTTPS'] === 'on') 
      $link = "https"; 
  else
      $link = "http"; 
  
  // Here append the common URL characters. 
  $link .= "://"; 
  
  // Append the host(domain name, ip) to the URL. 
  $link .= $_SERVER['HTTP_HOST']; 
  
  // Append the requested resource location to the URL 
  $link .= $_SERVER['REQUEST_URI']; 
  ?&gt; 
  
  
  &lt;center&gt;&lt;a href="https://www.facebook.com/sharer/sharer.php?
  
  
  &lt;?php echo $link; ?&gt;
  
  "&gt;Facebook&lt;/center&gt;
  </code></pre>
  
  <p>I am getting an error on line 20 saying FATAL ERROR syntax error, unexpected '&lt;', expecting end of file on line number 20</p>