Results 1 to 4 of 4

Thread: Something wrong with my code

  1. #1
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default Something wrong with my code

    In this code I am validating to make sure the comment made is between 3 characters and 400 characters... Though... it isn't working...
    PHP Code:
    <!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<=&& $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...

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    This line:

    Code:
    $comment  = strip_tags($_POST['Comment'])
    is missing a semicolon ';'

    That is your problem.
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. The Following User Says Thank You to thetestingsite For This Useful Post:

    Rockonmetal (04-01-2008)

  4. #3
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Thanks! pesky semicolons... why couldn't the error just say "Hey fool! Your missing a semicolon? lol" Thanks man

  5. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Rockonmetal View Post
    why couldn't the error just say "Hey fool! Your missing a semicolon."
    That would be too easy
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •