Jump to content

Syntan Error


shadowayex

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

can you show some more of the code and what error it gives? the syntax of what you posted isnt really wrong as far as i can see

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...