# Bldg a FORUM - the FORM doesn't display - WHY?

**URL:** <https://forum.kirupa.com/t/bldg-a-forum-the-form-doesnt-display-why/329311>\
**Category:** programming\
**Created:** [August 12, 2012, 6:49pm UTC](https://forum.kirupa.com/t/bldg-a-forum-the-form-doesnt-display-why/329311 "2012-08-12T18:49:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scotty13](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@Scotty13](https://forum.kirupa.com/u/Scotty13)\
**Post date:** [August 12, 2012, 6:49pm UTC](https://forum.kirupa.com/t/bldg-a-forum-the-form-doesnt-display-why/329311/1 "2012-08-12T18:49:52Z")

</div>

Trying to build a forum. My two Tables that I built for this forum are good.  
When I test in my browsers…  
I click on a topic from my index.php  
It goes to section.php?id=36 (script below)  
If I click on my type=“submit” value=“Take Off With A Different Conversation” button.  
I get this “ERROR: You do not exist in the system.” from new\_topic.php (script below).  
I’m following some tuts online and watched them over and over and its just not working, could you PLEASE HELP ME!  
Sorry for all the script, but I didnt want to leave anything out.  
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ section.php \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\<?php  
session\_start();  
include\_once ("…/wi\_class\_files/agoTimeFormat.php");  
$myAgoObject = new convertToAgo;  
include\_once “…/scripts/connect\_to\_mysql.php”; // Connect to the database  
// Get the section ID from the url variable coming in  
if (isset($\_GET[‘id’]) && $\_GET[‘id’] != “”) {  
$sid = preg\_replace(’#[^0-9]#i’, ‘’, $\_GET[‘id’]); // filter all characters except numbers for security  
} else {  
echo “ERROR: Variables to run this script have been removed from the URL.”;  
exit();  
}  
// Query the database for that section id, make sure it exists and get the section title  
$sql = mysql\_query(“SELECT \* FROM forum\_sections WHERE id=’$sid’ LIMIT 1”);  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
echo “ERROR: That section does not exist you have tampered with our URLs.”;  
exit();  
}  
while($row = mysql\_fetch\_array($sql)){  
$sectionTitle = $row[“title”];  
}  
// Use the section ID to query the “forum\_posts” table in the database to get all the threads for this section  
$sql = mysql\_query(“SELECT \* FROM forum\_posts WHERE type=‘a’ AND section\_id=’$sid’ ORDER BY date\_time DESC LIMIT 25”);  
$dynamicList = “”;  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
$dynamicList = “There are no threads in this section yet. You can be the first to post.”;  
} else {  
while($row = mysql\_fetch\_array($sql)){  
$thread\_id = $row[“id”];  
$post\_author = $row[“post\_author”];  
$post\_author\_id = $row[“post\_author\_id”];  
$date\_time = $row[“date\_time”];  
$convertedTime = ($myAgoObject -\> convert\_datetime($date\_time));  
$whenPost = ($myAgoObject -\> makeAgo($convertedTime));  
$thread\_title = $row[“thread\_title”];  
$dynamicList .= ‘\<img src=“style/threadPic.jpg” width=“26” height=“18” alt=“Topic” /\> ’ . $post\_author . ’ - \<a href="view\_thread.php?id=’ .  
$thread\_id . ‘"\>’ . $thread\_title . '\</a\> - ’ . $whenPost . ‘\<br /\>’;  
}  
}  
?\>  
\<head\>  
\<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /\>  
\<link href=“style/style.css” rel=“stylesheet” type=“text/css” /\>  
\<link rel=“icon” href=“favicon.ico” type=“image/x-icon” /\>  
\<link rel=“shortcut icon” href=“favicon.ico” type=“image/x-icon” /\>  
\<title\>\<?php echo $sectionTitle; ?\> Work & Trip Forum\</title\>  
\<meta name=“Keywords” content=“Funny, work, coworker, work, today, wow, forum, airline, blog, announcing, announcer, announced, announce, blog, blogging, blogger,  
travel, tips, heard, tips, suggestions, nightmares, anniversary, retirement, birthday, party, heard, rumor, chat, gossip” /\>  
\</head\>  
\<body\>  
\<div align=“center”\>  
\<?php include\_once(“template\_header.php”); ?\>  
\</div\>

\<table style=“background-color: #FFFFFF; border:#069 1px solid; border-top:none;” width=“900” border=“0” align=“center” cellpadding=“12” cellspacing=“0”\>  
\<tr\>  
\<td width=“731” valign=“top”\>  
\<div id=“breadcrumbs”\>\<a href=“[http://www](http://www).\*\*\*\*\*\*\*\***.com"\>Return Home: \</a\> ← \<a  
href="http://**.com/root/forum/index.php”\>Return: Work & Trip Topics\</a\>\</div\>  
\<h1 style=“margin-left:12px;”\>\<?php echo $sectionTitle; ?\> \</h1\>  
\<form action=“new\_topic.php” method=“post”\>  
\<input name=“forum\_id” type=“hidden” value="\<?php echo $sid; ?\>" /\>  
\<input name=“forum\_title” type=“hidden” value="\<?php echo $sectionTitle; ?\>" /\>  
\<input name=“myBtn1” type=“submit” value=“Take Off With A Different Conversation” style=“font-size:16px; padding:8px;” /\>  
\</form\>  
\<br /\>\<br /\>  
\<div style=“margin-left:12px; font-size:14px; line-height:1.5em;”\>\<?php echo $dynamicList; ?\>\</div\>  
\<br /\>\<br /\>\<br /\>\</td\>  
\<td width=“189” valign=“top”\>\<div style=" width:160px; height:600px; background-color: #F0F0F0; color: #CCC; padding:12px;"\> \<br /\>  
\<br /\>

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ new\_topic.php \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
\<?php  
session\_start();  
include\_once “…/scripts/connect\_to\_mysql.php”; // Connect to the database  
// Check to see if the user is logged in with session variables  
if (!isset($\_SESSION[‘userloca’]) || $\_SESSION[‘userloca’] == “”) {  
echo “You’ll need to check in first before you can post anything on your Work & Trip Forum.”;  
exit();  
} else {  
// Assume they are a tktedmembers because they have a locator session variable set  
// Check the database to be sure that their ID, locator, and email session variables all match in the database  
$u\_id = mysql\_real\_escape\_string($\_SESSION[‘id’]);  
$u\_name = mysql\_real\_escape\_string($\_SESSION[‘username’]);  
$u\_email = mysql\_real\_escape\_string($\_SESSION[‘useremail’]);  
$u\_loca = mysql\_real\_escape\_string($\_SESSION[‘userloca’]);  
$sql = mysql\_query(“SELECT \* FROM myMembers WHERE id=’$u\_id’ AND username=’$u\_name’ AND email=’$u\_email’ AND locator=’$u\_loca’”);  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
echo “ERROR: You do not exist in the system.”;  
exit();  
}

}

// Check to make sure the URL variables of “sid” and “title” are set  
if (!isset($\_POST[‘forum\_id’]) || $\_POST[‘forum\_id’] == “” || !isset($\_POST[‘forum\_title’]) || $\_POST[‘forum\_title’] == “”) {  
echo “Important variables are missing”;  
exit();

} else {  
// Acquire the variables and proceed to show them a form for creating a new topic  
$forum\_section\_id = preg\_replace(’#[^0-9]#i’, ‘’, $\_POST[‘forum\_id’]);  
$forum\_section\_title = preg\_replace(’#[^A-Za-z 0-9]#i’, ‘’, $\_POST[‘forum\_title’]);  
}

$sql = mysql\_query(“SELECT \* FROM forum\_sections WHERE id=’$forum\_section\_id’ AND title=’$forum\_section\_title’”);  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
echo “ERROR: That section does not exist.”;  
exit();

}  
?\>

\<head\>  
\<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /\>  
\<link href=“style/style.css” rel=“stylesheet” type=“text/css” /\>  
\<title\>\<?php echo $sectionTitle; ?\>Work & Trip Forum\</title\>  
\<script type=“text/javascript” language=“javascript”\>  
\<!–  
function validateMyForm ( ) {  
var isValid = true;  
if ( document.form1.post\_title.value == “” ) {  
alert ( “Please type in a title for this topic” );  
isValid = false;  
} else if ( document.form1.post\_title.value.length \< 10 ) {  
alert ( “Your title must be at least 10 characters long” );  
isValid = false;  
} else if ( document.form1.post\_body.value == “” ) {  
alert ( “Please type in your topic body.” );  
isValid = false;  
}  
return isValid;  
}  
//–\>  
\</script\>  
\</head\>  
\<body\>  
\<?php include\_once(“template\_header.php”); ?\>  
\<table style=“background-color: #F0F0F0; border:#069 1px solid; border-top:none;” width=“900” border=“0” align=“center” cellpadding=“12” cellspacing=“0”\>  
\<tr\>  
\<td width=“666” valign=“top”\>  
\<div id=“breadcrumbs”\>\<a href=“[http://www](http://www).\*\*\*\*\*\*\*\*\*\*.com”\>Return Home: \*\*\*\*\*\*\*\*\*\*\</a\> ← \<a  
href=“http://\*\*\*\*\*\*\*\*\*\*\*.com/root/forum/index.php”\>Return: Work & Trip Forum\</a\> ← \<a href=“section.php?id=\<?php echo $forum\_section\_id; ?\>”\>\<?php echo  
$forum\_section\_title; ?\>\</a\>\</div\>  
\<h2\>Creating a new topic in the \<em\>\<?php echo $forum\_section\_title; ?\>\</em\>Work & Trip Form\</h2\>  
\<form action=“parse\_post.php” method=“post” name=“form1”\>  
\<input name=“post\_type” type=“hidden” value=“a” /\>  
Announcer:\<br /\>\<input name=“topic\_author” type=“text” disabled=“disabled” maxlength=“64” style=“width:96%;” value="\<?php echo $u\_name; ?\>" /\>  
\<br /\>\<br /\>  
Announcement Title:\<br /\>\<input name=“post\_title” type=“text” maxlength=“64” style=“width:96%;” /\>\<br /\>\<br /\>  
Tell Us What Happen Today… \<span class=“smtext”\> (Use only fictitious names if describing a passenger)  
\</span\>\<br /\>  
\<br /\>  
Please type in your topic body:\<br /\>\<textarea name=“post\_body” rows=“15” style=“width:96%;”\>\</textarea\>  
\<br /\>\<br /\>\<input name="" type=“submit” value=“Post Announcement!” onclick=“javascript:return validateMyForm();”/\>  
\<input name=“fsID” type=“hidden” value="\<?php echo $forum\_section\_id; ?\>" /\>  
\<input name=“fsTitle” type=“hidden” value="\<?php echo $forum\_section\_title; ?\>" /\>  
\<input name=“uid” type=“hidden” value="\<?php echo $\_SESSION[‘id’]; ?\>" /\>  
\<input name=“uloca” type=“hidden” value="\<?php echo $\_SESSION[‘userloca’]; ?\>" /\>  
\</form\>

* * *

Scotty13
