Hello everybody! I am in the process of adding a shoutbox to my site. I am trying to make it so that when a member is logged in, the shout box form will be shown. And when a member is not logged in then it just shows a "Login To Chat" message. I am doing so with the php code below. http://pastebin.com/nNThRUAL This PHP code, however, is within a DIV and i cant seem to get the div that this code falls between to close. Please help and thanks in advance.
Putting all the html in an echo like that is just a bad idea. It's much better to just close the php tag right after the IF statement. ex: <?php if(isset($_SESSION['username']) && isset($_SESSION['password'])): ?> --- html stuff --- <?php else: ?> --- other html stuff --- <?php endif; ?> Code (markup): Anyway I found a problem with your code, on lines 22 and 23 you are opening new php blocks but you are already in one. change those lines to: <input type='hidden' id='token' name='token' value='". $token ."' /> Code (markup): and <input type='hidden' id='name' name='name' value='". $mem_name ."' /> Code (markup):
Thanks leh for the quick response. I feel like such an idiot as I had already put a big block of html between php on another page of my site, using the method you replied with. Anyway thanks again for helping!