Help! Unexpected End Syntax Error

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply

Fri Oct 05, 2012 9:27 am

Hello Absolute Newbie Here,

I have this code on a page for a login website. It is the page you land on if you have successfully logged in.
I keep getting this error --->
Parse error: syntax error, unexpected $end in D:\Hosting\9866233\html\newlaw\login_success.php on line 38
What am i doing wrong? All i want is for the user to land on this page if they login properly and that no one can view the page by just entering the direct url.

Code: Select all

if(!empty($_SESSION["myusername"])){        {
        // User not logged in, redirect to login page
        Header("Location: main_login.php");

// Member only content
// ...
// ...
// ...

// Display Member information
echo "<p>User ID: " . $_SESSION["valid_id"];
echo "<p>Username: " . $_SESSION["valid_user"];
echo "<p>Logged in: " . date("m/d/Y", $_SESSION["valid_time"]);

// Display logout link
echo "<p><a href=\"loggout.php\">Click here to logout!</a></p>";



php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Fri Oct 05, 2012 9:38 am

The error means that your </html> tag occurred in an unclosed php block. in the selection provided it happens because you double your opening braces after the if statement, but don't close the outter block. may also need to add opening html and body tags if they're not already in the omitted passages.


Wed Oct 10, 2012 2:23 pm

Thanks a bunch!

Post Reply