EDIT- Just need to find out why variables aren't being written in the fwrite function. my $pageIdentity isn't being written (it being a variable). That whole word is being ommited

Hello. I'm currently making a blog and long story short, I'm almost done. I've decided that upon me submitting the blog form, it will tkae the information, store it in the database, and then it will create the page (and thus from there it will have the article written)

I'm wondering if there's a way to make THIS code
Code:
<?php $pageIdentity="Blog".;
include("../../settings.php");
?>
<div id="wrapper">
    <?php include("../../header.php");?>
    <div id="main">
        <?php include("../../menu.php");?>
        <div id="page">
                <div id="content">
                    <div class="post">                            
                        <h2 class="title"><a href="#">Blog Homepage</a></h2>
                        <p class="meta">Posted  on  &nbsp;&bull;&nbsp; <a href="#" class="permalink">Full article</a></p>
                        <div class="entry">
                            <p><img src="../images/img04.jpg" width="186" height="186" alt="" class="alignleft border" />Article Content goes here.</p>
                        </div>
                    </div>
                </div>
<?php include ("../../sidebar.php");?>
        </div>
    </div>
    <?php include("../../footer.php");?>
</div>
</body>
</html>
Be the default code that's written in the file (the fopen() function will create the page and I want that to be defaulted)

Here is what I have for my submission page
Code:
$insertionToDatabase="INSERT INTO $tableName (PostNumber, DateTime, Content, type, URL) VALUES (NULL, FROM_UNIXTIME($dateTime), '$contentOfPost', '$type', '$URL')";


$result = mysql_query($insertionToDatabase);
if (!$result) {
    die('Invalid query: ' . mysql_error());
}
else
{
$fh = fopen($URL, 'w') or die("can't open file");
$stringData = "";
fwrite($fh, $stringData);


fclose($fh);
}
I have more than that but you shouldn't need to see any more. Basically if the results get entered into the database, write the file. $stringData I want to contain the first code segment I posted above.