hi i have been working on web design for a wile well. here is my new forum topic page, it dose its job really well i worked out error checking and sub pages yesterday. Well is there anything i forgot to do to it you can see?
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-Transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>New form topic</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css" />
<?php
////start session
include("include/session.php");
$usrname = $session->username;
$username = $session->username;
$numbers = $database->getNumMembers();
/////javascripts
include('includes-blocks/scripts.php');
?>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
</script>
</head>
<body>
<div id="container">
<?php
///header
include('includes-blocks/header.php');
?>
<div id="Layer_content">
<div id="content_outer">
<div class="pageheader">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td class="title">New form topic</td>
</tr>
<tr>
</table>
</div>
<table width="100%" border="1" cellspacing="2" cellpadding="0">
<tr>
<td width="20%" valign="top">
<?php
include('includes-blocks/whosonline.php');
?>
</td>
<td width="80%" valign="top">
<?php
///logged in
if($session->logged_in)
{
///get constants
$topic = $_GET['catagory'];
$title = $_GET['title'];
if (!isset($_GET['subpage'])) { //Start of the form for entering the data, before any processing done.
<form name="story" action="new_forum_topic.php?subpage=upload&catagory=<?php echo $topic ?>&title=<?php echo $title ?>" method="post">
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<tr class="page_title"><td width="70%">Add new topic</td><td width="15%"></td><td width="15%"></td></tr>
<tr class="page_contrast"><td width="70%"><input type="submit" value="Post Topic"> | <a href="forum_topic.php?id=<?php echo $topic ?>&title=<?php echo $title ?>">Back to forum</a></td><td width="15%"></td><td width="15%"></td></tr>
<tr class="page_contrast"><td width="70%">Title: <input type="text" name="subject"/></td><td width="15%"></td><td width="15%"></td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr class="mail_bcknd">
<td width="10%"></td>
<td width="80%">
<textarea name="post" rows="15" cols="80"></textarea>
</form>
</td>
<td width="10%"></td>
</tr>
</table>
<?php
}
else if (isset($_GET['subpage']) && $_GET['subpage'] == 'upload') {
////constants////
$subject = $_POST['subject'];
$post = $_POST['post'];
///set up time
date_default_timezone_set('Europe/London');
$today = date("F j, Y, g:i a");
////error checking
if ($subject == "" or $post == "") {
?>
<form name="story" action="new_forum_topic.php?subpage=upload&catagory=<?php echo $topic ?>&title=<?php echo $title ?>" method="post">
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<tr class="page_title"><td width="70%">Add new topic</td><td width="15%"></td><td width="15%"></td></tr>
<tr class="page_contrast"><td width="70%"><input type="submit" value="Post Topic"> | <a href="forum_topic.php?id=<?php echo $topic ?>&title=<?php echo $title ?>">Back to forum</a></td><td width="15%"></td><td width="15%"></td></tr>
<tr class="page_contrast"><td width="70%"><?php
if ($subject == "") {
echo "<font class=\"error\">You seem to have forgoten to add the subject of your post</font>";
}
?></td><td width="15%"></td><td width="15%"></td></tr>
<tr class="page_contrast"><td width="70%">Title: <input type="text" name="subject" value="<?php echo $subject; ?>"/></td><td width="15%"></td><td width="15%"></td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr class="mail_bcknd">
<td width="10%"></td>
<td width="80%">
<?php
if ($post == "") {
echo "<font class=\"error\">You seem to have forgoten to add the content of your post</font>";
}
?>
</td>
<td width="10%"></td>
</tr>
<tr class="mail_bcknd">
<td width="10%"></td>
<td width="80%">
<textarea name="post" rows="15" cols="80"><?php echo $post; ?></textarea>
</form>
</td>
<td width="10%"></td>
</tr>
</table>
<?php
////end the error checking
}
/////uploader component////
else {
////the uploading process/////
$sql = 'INSERT INTO `forum-posts` (`id`, `post-id`, `username`, `date`, `subject`, `post`, `lastpost`, `lastposttime`) VALUES (\'\', \''.$topic.'\', \''.$username.'\', \''.$today.'\', \''.$subject.'\', \''.$post.'\', \''.$username.'\', \''.$today.'\');';
$query = mysql_query($sql);
if(!$query) {
///// error out /////
echo "There was an error, please try again.";
print mysql_error();
}
else
?>
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<tr class="page_title"><td width="70%">Uploaded</td><td width="15%"></td><td width="15%"></td></tr>
</table>
<table width="100%" border="0" cellpadding="3" cellspacing="0" >
<tr>
<td width="15%" class="mail_bcknd"></td>
<td width="70%">
<p style="margin-bottom: 13pt" class="MsoNormal"><span style="color: #242424; font-family: ArialMT" class="Apple-style-span">Thank you very much for contributing.</span></p><p style="margin-bottom: 13pt" class="MsoNormal"><span style="color: #242424; font-family: ArialMT" class="Apple-style-span">You may now go back to the forum page. Or any other page ^_^</span></p>
</td>
<td width="15%" class="mail_bcknd"></td>
</tr>
<tr class="mail_bcknd">
<td width="15%" class="mail_bcknd"></td>
<td width="70%" align="center">
<p style="margin-bottom: 13pt" class="MsoNormal"><span style="color: #242424; font-family: ArialMT" class="Apple-style-span"><a href="forum.php">Back to fourm</a> | <a href="forum_topic.php?id=<?php echo $topic ?>&title=<?php echo $title ?>">Back to <?php echo $title; ?></a></span></p>
</td>
<td width="15%" class="mail_bcknd"></td>
</tr>
</table>
<?php
/////////////////update forum lastpost/////////////
////load the last record for update//////
$ideal = $_POST['subject'];
$sql = mysql_query("SELECT * FROM `forum-posts` WHERE `subject` = '$ideal'");
$row = mysql_fetch_row($sql);
$number = "$row[0]";
/////update the topic headings with the new data///
$query = "UPDATE `forum-topics` SET `lastpost` = '$username', `lastposttime` = '$today', `lasttopic` = '$subject', `lastid` = $number WHERE `id` = '$topic'";
if ( !mysql_query( $query ) ) {
echo "There was an error, please try again.";
echo mysql_error( );
}
else
{
}
}
}
}
else {
include("includes-blocks/frontpage.html");
}
?>
</td>
</tr>
</table>
</div>
<div id="footer">
<img src="images/header/page_footer.png" alt="footer" />
</div>
</div></div>
</body>
</html>