PDA

View Full Version : Something wrong with my code



Rockonmetal
04-01-2008, 12:43 AM
In this code I am validating to make sure the comment made is between 3 characters and 400 characters... Though... it isn't working...

<!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=utf-8" />
<script language="javascript" type="text/javascript" src="niceforms.js"></script>
<style type="text/css" media="screen">@import url(niceforms-default.css);</style>
<?php
$username = $_SESSION['Username'];
$password = $_SESSION['Password'];
$email = $_SESSION['Email'];
$ID = $_SESSION['ID'];
$rating = $_POST['rating'];
$comment = strip_tags($_POST['Comment'])
$lcomment = strlen($comment); //Line 14 of the code thats not functioning
if($lcomment<=400 && $lcomment>=3){
$correct = 0;
$correct++;
}else{
$correct = $correct*0;
}
if($rating<=5 && $rating>=0){
$correct++;
}else{
$correct = $correct*0;
}
$time = date('h:i:s A');
$date = date('m/d/Y');
?></head>
<body>
<div id="container">
<form action="1c.php" method="post" class="niceform">
<br />Hey <?php echo $username;?>! Check your comment to make sure its what you want to say!

<label for="Comment">Your Comment</label>
<br /><?php $comment; ?>
<br />
<label for="rating">Rating:</label>
You are rating the DVD Rewinder at <?php echo $rating; ?> stars.
<br />
<?php
if($correct==2){
echo '<br /><a href="1b.php">Edit your comment and or rating!</a>';
echo '<br /><input type="submit" value="Post Comment" />';
}else{
echo '<br /><a href="1b.php">You need to edit your comment</a>';
}
?>


</form>
</div>
</body>
</html>
When i load it I get:
Parse error: parse error, unexpected T_VARIABLE in C:\netserver\www\Pureadd\pictures\comment\1c.php on line 14
Help is greatly appreciated... thanks! *The post['Comment'] line is right...

thetestingsite
04-01-2008, 12:48 AM
This line:



$comment = strip_tags($_POST['Comment'])

is missing a semicolon ';'

That is your problem.
Hope this helps.

Rockonmetal
04-01-2008, 01:41 AM
Thanks! pesky semicolons... why couldn't the error just say "Hey fool! Your missing a semicolon? lol" Thanks man

thetestingsite
04-01-2008, 03:38 PM
why couldn't the error just say "Hey fool! Your missing a semicolon."

That would be too easy :)