Conditional Statements in PHP code Between HTML Code

You probably forgot the endif of the alternative control structure syntax:

<?php if(check if user is logged in): ?>
<display users profile in html>
<?php else: ?>
<display an error>
<?php endif; ?>

Omitting the braces as you wrote is not possible. It is only possible if it is followed by a regular statement.

Leave a Comment