Well it works, it displays the categories fine. I also have the viewForum page working, which uses almost identical code and that works fine as well. But I need to get it so that when i click on the category I want, it only displays the message headers from that category on the viewForum page. Any ideas?
I also have the script which creates a new thread:
<?php
include "sqlconnect.php"; //connection string
print "<link rel='stylesheet' href='style.css' type='text/css'>";
print "<table class='maintables'>";
print "<tr class='headline'><td>Post a message</td></tr>";
print "<tr class='maintables'><td>";
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$yourpost=$_POST['yourpost'];
$title=$_POST['title'];
if(strlen($name)<1)
{
print "You did not type in a name."; //no name entered
}
else if(strlen($yourpost)<1)
{
print "You did not type in a post."; //no post entered
}
else if(strlen($title)<1)
{
print "You did not enter a title."; //no subject entered
}
else
{
$thedate=date("U"); //get unix timestamp
$displaytime=date("F j, Y, g:i a");
//we now strip HTML injections
$subject=strip_tags($title);
$name=strip_tags($name);
$yourpost=strip_tags($yourpost);
$insertpost="INSERT INTO forum_posts(author,title,post,showtime,realtime,lastposter) values('$name','$title','$yourpost','$displaytime','$thedate','$name')";
mysql_query($insertpost) or die("Could not insert post"); //insert post
print "Message posted, go back to <A href='index.php'>Forum</a>.";
}
}
else
{
print "<form action='post.php' method='post'>";
print "Your name:<br>";
print "<input type='text' name='name' size='20'><br>";
print "Title:<br>";
print "<input type='text' name='title' size='20'><br>";
print "Your message:<br>";
print "<textarea name='yourpost' rows='5' cols='40'></textarea><br>";
print "<input type='submit' name='submit' value='submit'></form>";
}
print "</td></tr></table>";
?>
But I have no idea how to enure that the new thread is added under the appropriate category, do you have any suggestions on how to do this?
Yeah, simple is good =)
Tom