Jump to content

Syntan Error


shadowayex
 Share

Recommended Posts

Ok, I've been editing my PHP pages a bit so that instead of echoing the HTML, I close of the PHP at the end of an if statement, write the HTML, then open the PHP back up. I do it a lot throughout the code, but there seems to be a syntax error that I'm not sure why it is. Here's an example:

if($_SESSION['logged_in'] != true) {?> <form action="messages.php?mode=login" method="post"> <div> Username: <input type="text" name="username" value="" /><br /> Password: <input type="password" name="password" value="" /><br /> <input type="submit" name="submit" value="Login" /> </div><!-- 50 --> </form><?php }else {?>

The problem is the } on line 52. The comment <!-- 50 --> is like 50, for a little extra information. Is my syntax actually wrong? I just recently learned about being able to close in the middle of a statement, so I'm not sure out to effectively use it. Can someone tell me what is wrong.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...