PHP if else echo
html, php, session
Solution
My best guess is that you have short tags disabled. Make sure that short tags (`<?` instead of `<?php`) are enabled. Or better yet, don't use them!.
Replace all of your `<?` with `<?php`, complete tag names will ensure that PHP is parsed correctly.
`<?=` will still be evaluated and parsed regardless of short tags being enabled or disabled.
Look at the source of the page, and see if you can see the PHP code there, if you can, short tags are not being parsed by the server.
Problem
I have problem with my code. I have this code: ``` <?php include "../config.php"; ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Title</title> <link rel="stylesheet" href="../style.css" type="text/css" /> </head> <? if (!empty($_SESSION['LoggedIn'])) { ?> <div class="row"> <div class="span2"> <p><h3>Welcome <?=$_SESSION['login']?> loggedin: <?=$_SESSION['LoggedIn']?></h3> </p> </div> </div> <br> <div class="row"> <div class="span2"> <h1>Menu</h1> </div> <div class="span5"> <h2>Header1:</h2> </div> </div> <? } else { ?> <h1>Error</h1> <? } ?> </div> </body> </html> ``` The result is: ``` Welcome admin loggedin: 1 Menu Header1: Error ``` Why error??? Where I have mistake? I think that all bracket is good. Maybe it can be problem with my localhost??? Or I dont know. Can you give me advice?