# My DIV section is not displaying when I test in browser

**URL:** https://forum.kirupa.com/t/my-div-section-is-not-displaying-when-i-test-in-browser/328153
**Category:** Uncategorized
**Created:** [April 23, 2012, 6:31am UTC](https://forum.kirupa.com/t/my-div-section-is-not-displaying-when-i-test-in-browser/328153 "2012-04-23T06:31:33Z")
**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: [April 23, 2012, 6:31am UTC](https://forum.kirupa.com/t/my-div-section-is-not-displaying-when-i-test-in-browser/328153/1 "2012-04-23T06:31:33Z")

</div>

When I test view\_thread.php, I get this echo response from line 13 ERROR: That thread does not exist. DIV is at line 167-191 (marked). FYI - The two database Tables for this Forum that I’m “trying” to build are up and running.

\<?php  
session\_start();  
include\_once “…/scripts/connect\_to\_mysql.php”; // Connect to the database  
// Connect to the class file for converting date\_time to “Ago” format  
include\_once ("…/wi\_class\_files/agoTimeFormat.php");  
$myAgoObject = new convertToAgo; // Establish the object  
// Get the “id” URL variable and query the database for the original post of this thread  
$thread\_id = preg\_replace(’#[^0-9]#i’, ‘’, $\_GET[‘id’]);  
$sql = mysql\_query(“SELECT \* FROM forum\_posts WHERE id=’$thread\_id’ AND type=‘a’ LIMIT 1”);  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
echo “ERROR: That thread does not exist.”;  
exit();  
}  
while($row = mysql\_fetch\_array($sql)){  
$post\_author = $row[“post\_author”];  
$post\_author\_id = $row[“post\_author\_id”];  
$date\_time = $row[“date\_time”];  
$date\_time = strftime("%b %d, %Y", strtotime($date\_time));  
$section\_title = $row[“section\_title”];  
$section\_id = $row[“section\_id”];  
$thread\_title = $row[“thread\_title”];  
$post\_body = $row[“post\_body”];  
}  
?\>  
\<?php  
// Now query any responses out of the database and place in a dynamic list  
$all\_responses = “”;  
$sql = mysql\_query(“SELECT \* FROM forum\_posts WHERE otid=’$thread\_id’ AND type=‘b’”);  
$numRows = mysql\_num\_rows($sql);  
if ($numRows \< 1) {  
$all\_responses = ‘\<div id=“none\_yet\_div”\>Nobody has responded to this yet, you can be the first.\</div\>’;  
} else {  
while($row = mysql\_fetch\_array($sql)){  
$reply\_author = $row[“post\_author”];  
$reply\_author\_id = $row[“post\_author\_id”];  
$date\_n\_time = $row[“date\_time”];  
$convertedTime = ($myAgoObject -\> convert\_datetime($date\_n\_time));  
$whenReply = ($myAgoObject -\> makeAgo($convertedTime));  
$reply\_body = $row[“post\_body”];  
$all\_responses .= ‘\<div class=“response\_top\_div”\>Re: ’ . $thread\_title . ’ &nbsp; &nbsp; • &nbsp; &nbsp; ’ . $whenReply . ’  
\<a href="…/res.php?id=’ . $reply\_author\_id . ‘"\>’ . $reply\_author . ‘\</a\> Said:\</div\>  
\<div class=“response\_div”\>’ . $reply\_body . ‘\</div\>’;  
}  
}  
?\>  
\<?php  
// Be sure the user session vars are all set in order to show them the “replyButton”  
$replyButton = 'You must \<a href=“[http://www](http://www)._**.com/ckin.php"\>CHECK IN\</a\> to respond’;  
if (isset($\_SESSION[‘id’]) && isset($\_SESSION[‘username’]) && isset($\_SESSION[‘useremail’]) && isset($\_SESSION[‘userloca’])) {  
$replyButton = ‘\<input name=“myBtn1” type=“submit” value=“Post a Response” style=“font-size:16px; padding:12px;” onmousedown=“javascript:toggleForm(‘reponse\_form’);” /\>’;  
}  
// 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) {  
$replyButton = ‘You Must \<a href="…/ckin.php"\>CHECK IN\</a\> to Respond’;  
}  
?\>  
\<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)”\>  
\<html xmlns=“[http://www.w3.org/1999/xhtml](http://www.w3.org/1999/xhtml)”\>  
\<head\>  
\<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” /\>  
\<link href=“style/style.css” rel=“stylesheet” type=“text/css” /\>  
\<script src="…/js/jquery-1.7.1.js" type=“text/javascript”\>\</script\>  
\<title\>\<?php echo $thread\_title; ?\>\</title\>  
\<script language=“javascript” type=“text/javascript”\>  
function toggleForm(x) {  
if ($(’#’+x).is(":hidden")) {  
$(’#’+x).slideDown(200);  
} else {  
$(’#’+x).slideUp(200);  
}  
}  
$(’#responseForm’).submit(function(){$(‘input[type=submit]’, this).attr(‘disabled’, ‘disabled’);});  
function parseResponse ( ) {  
var thread\_id = $("#thread\_id");  
var post\_body = $("#post\_body");  
var fs\_id = $("#forum\_section\_id");  
var fs\_title = $("#forum\_section\_title");  
var u\_id = $("#tktedmembers\_id");  
var u\_loca = $("#tktedmembers\_locator");  
var url = “parse\_post.php”;  
if (post\_body.val() == “”) {  
$("#formError").html(’\<font size="+2"\>Please type something\</font\>’).show().fadeOut(3000);  
} else if (post\_body.val().length \< 2 ) {  
$("#formError").html(’\<font size="+2"\>Your post must be at least 2 characters long’).show().fadeOut(3000);  
} else {  
$("#myBtn1").hide();  
$("#formProcessGif").show();  
$.post(url,{ post\_type: “b”, tid: thread\_id.val(), post\_body: post\_body.val(), fsID: fs\_id.val(), fsTitle: fs\_title.val(), uid: u\_id.val(), uloca: u\_loca.val() } , function(data) {  
$("#none\_yet\_div").hide();  
var myDiv = document.getElementById(‘responses’);  
var magicdiv1 = document.createElement(‘div’);  
magicdiv1.setAttribute(“class”, “response\_top\_div”);  
magicdiv1.htmlContent = ‘Re: \<?php echo $thread\_title ?\>’;  
magicdiv1.innerHTML = ‘Re: \<?php echo $thread\_title ?\>’;  
myDiv.appendChild(magicdiv1);  
var magicdiv = document.createElement(‘div’);  
magicdiv.setAttribute(“class”, “response\_div”);  
magicdiv.htmlContent = data;  
magicdiv.innerHTML = data;  
myDiv.appendChild(magicdiv);  
$(’#reponse\_form’).slideUp(“fast”);  
document.responseForm.post\_body.value=’’;  
$("#formProcessGif").hide();  
$("#myBtn1").show();  
});  
}  
}  
\</script\>  
\<style type=“text/css”\>  
\<!–  
.topic\_div {  
background-color: #D9F9FF;  
font-size:16px;  
padding:16px;  
border: #01B3D8 1px solid;  
margin-bottom:6px;  
font-weight: 500;  
color:#069;  
}  
.response\_top\_div {  
background-color: #E4E4E4;  
color: #666;  
font-size:14px;  
padding:4px;  
border: #CCC 1px solid;  
border-bottom:none;  
color: #999;  
}  
.response\_div {  
background-color: #FFF;  
font-size:14px;  
padding:12px;  
border:#CCC 1px solid;  
margin-bottom:6px;  
width:639px;  
overflow:hidden;  
}  
 #none\_yet\_div {  
background-color: #E4E4E4;  
font-size:16px;  
padding:16px;  
border: #CCC 1px solid;  
margin-bottom:6px;  
color: #999;  
}  
–\>  
\</style\>  
\</head\>  
\<body\>  
\<?php include\_once(“template\_header.php”); ?\>  
\<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=“666” valign=“top” style=“line-height:1.5em;”\>  
\<div id=“breadcrumbs”\>\<a href="[http://www](http://www).**_.com/root/index.php”\>Return Home: My Global PNR\</a\> ← \<a href=“http://\*\*\*\*\*\*\*\*\*\*\*.com/root/forum/index.php”\>Return: Work & Trip Forum\</a\> ← \<a href=“section.php?id=\<?php echo $section\_id; ?\>”\>\<?php echo $section\_title; ?\>\</a\>\</div\>  
\<br /\>  
\<span class=“topicTitles”\>\<?php echo $thread\_title; ?\>\</span\>\<br /\>\<br /\>  
LINE 167: Topic Started by, TKTed Member: \<a href="…/res.php?id=\<?php echo $post\_author\_id; ?\>"\>\<?php echo $post\_author; ?\>\</a\>  
&nbsp; &nbsp; &nbsp; Created: \<span class=“topicCreationDate”\>\<?php echo $date\_time; ?\>\</span\>  
\<div class=“topic\_div”\>\<?php echo $post\_body; ?\>\</div\>  
\<div id=“responses”\>  
\<p\>&nbsp;\</p\>  
\<?php echo $all\_responses; ?\>\</div\>  
\<!-- START DIV that contains the form --\>  
\<div id=“reponse\_form” style=“display:none; background-color: #BAE1FE; border:#06C 1px solid; padding:16px;”\>  
\<form action=“javascript:parseResponse();” name=“responseForm” id=“responseForm” method=“post”\>  
Please type in your response here \<?php echo $u\_name; ?\>:\<br /\>\<textarea name=“post\_body” id=“post\_body” cols=“64” rows=“12” style=“width:98%;”\>\</textarea\>  
\<div id=“formError” style=“display:none; padding:16px; color:#F00;”\>\</div\>  
\<br /\>\<br /\>\<input name=“myBtn1” id=“myBtn1” type=“submit” value=“Submit Your Response” style=“padding:6px;” /\> \<span id=“formProcessGif” style=“display:none;”\>\<img src="…/images/loading.gif" width=“28” height=“10” alt=“Loading” vspace=“2” hspace=“48” /\>\</span\>  
or \<a href="#" onclick=“return false” onmousedown=“javascript:toggleForm(‘reponse\_form’);”\>Cancel\</a\>  
\<input name=“thread\_id” id=“thread\_id” type=“hidden” value="\<?php echo $thread\_id; ?\>" /\>  
\<input name=“forum\_section\_id” id=“forum\_section\_id” type=“hidden” value="\<?php echo $section\_id; ?\>" /\>  
\<input name=“forum\_section\_title” id=“forum\_section\_title” type=“hidden” value="\<?php echo $section\_title; ?\>" /\>  
\<input name=“tktedmembers\_id” id=“tktedmembers\_id” type=“hidden” value="\<?php echo $\_SESSION[‘id’]; ?\>" /\>  
\<input name=“tktedmembers\_locator” id=“tktedmembers\_locator” type=“hidden” value="\<?php echo $\_SESSION[‘userloca’]; ?\>" /\>  
\</form\>  
\</div\>  
\<p\>  
\<!-- END DIV that contains the form --\>  
LINE 191: \<?php echo $replyButton; ?\>\</p\>  
\<p\>  
\<br /\>  
\<br /\>  
\</p\>\</td\>  
\<td width=“184” valign=“top”\>\<div style=" width:160px; height:600px; background-color: #F0F0F0; color: #CCC; padding:12px;"\> \<br /\>  
\<br /\>  
\<br /\>  
\<h3\>Contact us to place your AD here.\</h3\>  
\</div\>\</td\>  
\</tr\>  
\</table\>  
\<?php include\_once(“template\_footer.php”); ?\>  
\</body\>  
\</html\>  
Thanks in advance, Scott
