title: Displaying html of page only if session exists
body: <pre><code>  &lt;?php
  
  ini_set("log_errors", 1);
  ini_set("error_log", "errorlog.log");
  
  
  $recid= $_POST['recid'];
  $username = $_POST['name'];
  $email = $_POST['email'];
  $ownername = $_POST['ownername'];
  
  include ("connection.php");
  
  
  $result = $db-&gt;query("UPDATE users SET verified='y' WHERE recid='$recid'"); 
  
  $filename = str_replace(" ","_", trim($username) );
  mkdir("Business_Pages/". $filename."/");
  
  
  
  $jquery = "&lt;script src='http://code.jquery.com/jquery-1.9.1.min.js'&gt; &lt;/script&gt;";
  $jqueryui = "&lt;script src='http://code.jquery.com/ui/1.10.2/jquery-ui.js'&gt; &lt;/script&gt;";
  $jquerycss = "&lt;link rel='stylesheet' href='http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css'&gt;";
  $postdata = "&lt;script src='../../Scripts/postdata.js'&gt; &lt;/script&gt;";
  $pagecss = "&lt;link rel='stylesheet' href='../../CSS/businesspages.css'&gt;";
  $wclogo = "&lt;img src='../../wc.png' id='wc'&gt;";
  $postinput = "&lt;input type='text' id='post' placeholder='Post' name='post'&gt;";
  $postdate = "&lt;input type='text' id='date' placeholder='Enter Date' name='date'&gt;";
  $accountinfo = "&lt;table id='accountinfo'&gt; &lt;tr&gt; &lt;td&gt; &lt;img src='../../testresteraunt.png' id='testresteraunt'&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;                     &lt;td&gt; $username &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; $ownername &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;";
  $links = "&lt;table id='links'&gt; &lt;tr&gt; &lt;td&gt; &lt;/td&gt; &lt;td&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id='header'&gt;";
  
  $fp = fopen("Business_Pages/". $filename . "/" . $filename . ".html", "w");
  
  fwrite($fp,"&lt;?php session_start()");
  
  
  fwrite($fp,"if(isset($_SESSION['id'])) { ?&gt;");
  
  fwrite($fp,"&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt;");
  
  fwrite($fp,"&lt;/head&gt;");
  
  fwrite($fp,"&lt;body&gt;");
  
  fwrite($fp,"&lt;/body&gt; &lt;/html&gt;");
  
  fwrite($fp,"&lt;?php } ?&gt;");
  
  fclose($fp);
  
  $to = "$email";
  $subject = "Account Creation";
  $message = "Congratulations you have been accepted to Wolfeboro Connection";
  $from = "info@wolfeboroconnection.com";
  $headers = "From:" . $from;
  
  
  mail($to, $subject, $message, $headers)
  
  ?&gt;
  </code></pre>
  
  <p>Im trying only to show the html if a session is valid but php is saying that its an unexpected if statement and <br />
  <b>Parse error</b>:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in <b>/home/content/96/10688096/html/verify.php</b> on line <b>37</b><br /> Thanks in advance</p>