Well along the way to completing my site...
I have templated using a single page-display file called displaypage.php, which uses GET to figure out which page is being viewed. In my (MySQL) pages table, I have an ENUM field called "code_in" which can be 0 (off) or 1 (on). If it's on, the appropriate file, referenced in code_href, is included below the page description.
This is for pages where I'm going to be using code I want to keep separate, or for using php code in the body of the page. (I'm using a 3 column layout that generally includes php code on the very right, and keeps the page information, generally simply text from the database, in the middle).
For example, I've kept my resume in a file, resume.html, and my e-mail form in a file, e-mail.html, that I'm including, instead of putting in the database. I've also got biography.php, which contains specific queries and formatting for that page to be inserted in the body (instead of the right column, where most of my 'content' is going).
Now I'm working on my "tagboard". The method I've been using for these kinds of forms doesn't seem to be working. Since tagboard.php is included, the url is http://localhost/virtual/displaypage.php?catid=6&pageid=32.
<?php
$alltags = mysql_query("SELECT * FROM tagger");
while($tags = mysql_fetch_array($alltags)){
$tag_id = $tags["tag_id"];
$tag_name = $tags["tag_name"];
$tag = $tags["tag"];
echo("<div class=\"tagentry\">");
echo("<span class=\"tag_name\">");
echo("$tag_name: ");
echo("</span>");
echo("<span class=\"tag\">");
echo("$tag");
echo("</span>");
echo("</div>");
}
?>
</div>
<p>
<form action="<?php $_SERVER['PHP_SELF']?>" method="post">
<table border="0" cellspacing="0" cellpadding="0" class="tagtable">
<tr>
<td class="taglabel">
Name:
</td>
<td>
<input type="text" name="tagger_name" size="20">
</td>
</tr>
<tr>
<td class="taglabel" valign="top">
Comment:
</td>
<td>
<textarea cols="25" rows="3" name="tagger_comment">
</textarea>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type="submit" name="tagit" value="Tag-it">
</td>
</tr>
</table>
</form>
<?php
if (isset($_POST['tagit'])):
$tagger_name = $_POST['tagger_name'];
$tagger_comment = $_POST['tagger_comment'];
$sql = "INSERT INTO tagger ('tag_id','tag_name','tag') VALUES
('','$tagger_name','$tagger_comment')";
$result = mysql_query($sql);
echo("<div class='taggedtext'>Tagged!</div>");
endif;
?>
It will display a tag that I manually enter into the database, but attempting to tag with the form does nothing. I've used this same code effectively before...but with the commenter in its own window. I guess the post data isn't being included in the header since tagger.php is included, but what change should I make?