photec Posted March 2, 2010 Share Posted March 2, 2010 What I'm trying to do is when user logs in hide the log in form I have my log in form on my main menu. when I add this code in my header.php my site wont load at all. <?php if(!isset($_SESSION['SESS_MEMBER_ID'])){ <a class="green" href="/?content=member-profile">My Profile</a> | <a class="green" href="/logout.php">Logout</a> else{ <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <input name="login" type="text" class="textfield" id="login" /> <b>Login</b> <br></br> <input name="password" type="password" class="textfield" id="password" /> <b>Pass</b> <br></br> <div align="center"><input type="submit" name="Submit" value="Login" /> <a class="green" href="/?content=register-form">Sign up |</a></div> </form> } ?> Link to comment https://forums.phpfreaks.com/topic/193863-php-else-script-not-displaying/ Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 Probably cause you have a php start tag, an if then a bunch of raw html within the brackets. Either break php, echo it, or put it in a heredoc then echo the var. You should also enable errors cause that is surely throwing one. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193863-php-else-script-not-displaying/#findComment-1020296 Share on other sites More sharing options...
inversesoft123 Posted March 2, 2010 Share Posted March 2, 2010 <?php if(!isset($_SESSION['SESS_MEMBER_ID'])){ ?> <a class="green" href="/?content=member-profile">My Profile</a> | <a class="green" href="/logout.php">Logout</a> <? else{ ?> <form id="loginForm" name="loginForm" method="post" action="login-exec.php"> <input name="login" type="text" class="textfield" id="login" /> <b>Login</b> <br></br> <input name="password" type="password" class="textfield" id="password" /> <b>Pass</b> <br></br> <div align="center"><input type="submit" name="Submit" value="Login" /> <a class="green" href="/?content=register-form">Sign up |</a></div> </form> <? } ?> Link to comment https://forums.phpfreaks.com/topic/193863-php-else-script-not-displaying/#findComment-1020297 Share on other sites More sharing options...
teamatomic Posted March 2, 2010 Share Posted March 2, 2010 Yes, but try to get in the habit of not using short tags(<?) instead use the basic (<?php) tag. Unless you have absolute control over the server there is no telling when short tags might get turned off and your script will be broken. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/193863-php-else-script-not-displaying/#findComment-1020300 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.