how to create a new php page with php- apostrophe issue
<p>To be more clear, I do understand how to create a new php file with php, I'm using <code>fwrite</code>, like so:</p>

<pre><code>//actually create the file now

$my_file=$post_title_edited . ".php";;

$fh= fopen($my_file, 'w');

fwrite($fh, $head);
fwrite($fh, $body);
fwrite($fh, $php);
fwrite($fh, $php2);
fwrite($fh, $php3);
fwrite($fh, $phpend);
fwrite($fh, $end); 
fclose($fh);

//redirect to created file
header("location:". $post_title_edited .".php");
</code></pre>

<p>Now it all works just fine, or rather it would, if it were not for this issue:</p>

<pre><code>$php3='

session_start();

if(isset($_SESSION['login'])){
    $myusername = $_SESSION['login'];

    echo '  &lt;div id="header-logedin"&gt;
              &lt;h3&gt;Hello ' . $myusername . '&lt;/h3&gt;
              &lt;a href="login/logout.php"&gt;Log out&lt;/a&gt;
            &lt;/div&gt;&lt;!--header-logedin--&gt;
         ';
} else {
    echo $log;
}
</code></pre>

<p>As you can see, when i begin to set <code>$php3</code>, it is interupted by the apostrophe in the login from my first session call. Therefore it can't be set and in turn i can't write it into my new file, also <code>$php2</code> has this same problem. </p>

<p>What am i trying to do? In a nutshell: user posts from index.php information posts over onto new page created by this code, after data is checked against sql table to make sure it doesn't already exist, very much like a forum. I really hope this is something complicated and I'm not overlooking something incredibly obvious. Thanks in advance.</p>
