PHP Comment Script

techgeek1499

New Member
Messages
18
Reaction score
0
Points
0
I have a test page: http://www.techcorner.pcriot.com/test/reviews.php

The gray box area thing isn't centered in the page and I am wondering how to do that.

This isn't the full code because it's long and this is where it would be if anything.

Code:
<style>
/*COMMENTS
*------------------------------------*/

.postedby {
	text-align: Center;
	}
	
h3.formtitle {
	margin : 0px 0px 0px 12px;
	border-bottom: 1px dotted #ccc;
	padding-bottom: 8px;
	}

.commentbody {
	border-top: 1px dotted #ccc;
	}
	
/*gray box*/
.submitcomment, #submitcomment, #currentcomments, #rating, .textad {
	background-color: #F5F5F5;
	border: 1px dotted #ccc;
	width: 550px;
	}


/*FORMS
*------------------------------------*/

.form {
	font-size: 100%;
	background-color: #FAFAFA;
	border: solid 1px #C6C6C6;
	padding: 2px;
	}

.formtext {
	background-color: #FAFAFA;
	border: solid 1px #C6C6C6;
	padding: 2px;
	border-bottom: 1px dotted #ccc
	}

.form:hover, .formtext:hover {
	background: white;
	}
	
.form:focus, .formtext:focus {
	background: white;
	border: solid 1px #000000;
	}
	
.submit {
	background-color: #D3D3D3;
	border: solid 1px #C6C6C6;
	border-right:  solid 1px #9A9A9A;
	border-bottom:  solid 1px #9A9A9A;
	}
	
.submit:hover, .submit:focus {
	background: #EDEDED;
	}
	</style>

	
	";
//fetch all comments from database where the tutorial number is the one you are asking for
	$commentquery = mysql_query("SELECT * FROM comments WHERE tutorialid='$tutid' ORDER BY date DESC") or die(mysql_error());
//find the number of comments
	$commentNum = mysql_num_rows($commentquery);
//create a headline
	echo "<div id=\"currentcomments\" class=\"submitcomment\"><h3 class=\"formtitle\">Current Comments</h3>\n";
	echo $commentNum . " comments so far (<a href=\"#post\">post your own</a>)\n";
//for each comment in the database in the right category number...
	while($commentrow = mysql_fetch_row($commentquery)){
//for security, parse through the bbcode script
//the number corresponds to the column (the message is always stored in column 4
//COUTING STARTS at 0!!!
	$commentbb = BBCode($commentrow[4]);
//create the right date format
		$commentDate = formatDate($commentrow[6]);

		echo "<div class=\"commentbody\" id=\"$commentrow[0]\">\n
		<p>$commentbb</p>\n
		<p class=\"postedby\">Posted by ";
		if($commentrow[3]){
		echo "<a href=\"$commentrow[3]\">$commentrow[2]</a> ";
		} else {
		echo "$commentrow[2] ";
		}
		echo "on $commentDate | #$commentrow[0]</p>\n
		\n</div>";
		
	}
	echo "</div>";
}

function submitComments($tutid2,$tuturl){
//a javascript script to make sure all the required fields are filled in
?>
<script language="javascript">

function form_Validator(form)
{

  if (form.name.value == "")
  {
    alert("Please enter your name.");
    form.name.focus();
	return (false);
     }

  if (form.message.value == "")
  {
    alert("Please enter your message.");
    form.message.focus();
    return (false);
  }
  
  return (true);
  }
  //-->
  </script>
<?php
//create the form to submit comments
//you can add more fields, but make sure you add them to the db table and the page, submitcomment.php
	echo "
<a name=\"post\">
<div id=\"submitcomment\" class=\"submitcomment\">
<form name=\"submitcomment\" method=\"post\" action=\"submitcomment.php\" onSubmit=\" return form_Validator(this)\">
<table width=\"20%\">
		<tr>
				<th colspan=\"2\"><h3 class=\"formtitle\">Leave your comment:</h3></th>
		</tr>
		<tr>

				<th scope=\"row\"><p class=\"req\">Name:</p></th>
				<td><input class=\"form\" tabindex=\"1\" id=\"name\" name=\"name\" /></td>
		</tr>
		<tr>
				<th scope=\"row\"><p class=\"opt\">Email:</p></th>
				<td><input class=\"form\" tabindex=\"2\" id=\"email\" name=\"email\" /></td>
		</tr>
		<tr>

				<th scope=\"row\"><p class=\"opt\">URL:</p></th>
				<td><input class=\"form\" tabindex=\"3\" id=\"url\" name=\"url\" /></td>
		</tr>
		<tr valign=\"top\">
				<th scope=\"row\"><p class=\"req\">Comments:</p><br /></th>
				<td><textarea class=\"formtext\" tabindex=\"4\" id=\"message\" name=\"message\" rows=\"5\" cols=\"50\"></textarea></td>
		</tr>

		<tr>	
				<td>&nbsp;</td>
				<td><input type=\"submit\" name=\"post\" class=\"submit\" value=\"Submit Comment\" /><br />
				<p>Note:  Emails will not be visible or used in any way, and are not required.  Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted. </p>

<p>No HTML code is allowed.  Line breaks will be converted automatically.  URLs will be auto-linked.  Please use BBCode to format your text.</p>

</td>
		</tr>
</table>
<input type=\"hidden\" name=\"tuturl\" value=\"$tuturl\" />
<input type=\"hidden\" name=\"tutid2\" value=\"$tutid2\" />
</form>


</div>
";
}
?>
 

descalzo

Grim Squeaker
Community Support
Messages
9,373
Reaction score
326
Points
83
Adjust your css

Code:
/*gray box*/
.submitcomment, #submitcomment, #currentcomments, #rating, .textad {
	background-color: #F5F5F5;
	border: 1px dotted #ccc;
	width: 550px;
                     margin: auto;
	}
 

techgeek1499

New Member
Messages
18
Reaction score
0
Points
0
Adjust your css

Code:
/*gray box*/
.submitcomment, #submitcomment, #currentcomments, #rating, .textad {
	background-color: #F5F5F5;
	border: 1px dotted #ccc;
	width: 550px;
                     margin: auto;
	}

Yay thank you. That worked perfectly :) Thanks again.
 
Top