cangrejero Posted December 9, 2007 Share Posted December 9, 2007 My script reads: <? /** * User has already logged in, so display relavent links, including * a link to the admin center if the user is an administrator. */ if($session->logged_in){ echo "<h1>Logged In</h1>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] " ."[<a href=\"useredit.php\">Edit Account</a>] "; if($session->isAdmin()){ echo "[<a href=\"admin/admin.php\">Admin Center</a>] "; } echo "[<a href=\"process.php\">Logout</a>]"; } else{ How can I insert a link to a new page BEFORE the "else" statement. Any guidance appreciated. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/ Share on other sites More sharing options...
~n[EO]n~ Posted December 9, 2007 Share Posted December 9, 2007 You have already inserted lots of links <a href... >, before else, same like that again use echo <a href... Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410175 Share on other sites More sharing options...
Lamez Posted December 9, 2007 Share Posted December 9, 2007 use this print <<<RD POST YOUR HTML CONTENT HERE RD; Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410197 Share on other sites More sharing options...
Aureole Posted December 9, 2007 Share Posted December 9, 2007 use this print <<<RD POST YOUR HTML CONTENT HERE RD; Make sure there is no white-space before RD; and as an added note you don't have to use RD you can use anything, e.g. <?php echo <<<HTML // Your HTML here... HTML; Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410222 Share on other sites More sharing options...
Lamez Posted December 9, 2007 Share Posted December 9, 2007 oh ya, sorry. I love prints they make life easier. Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410226 Share on other sites More sharing options...
cangrejero Posted December 9, 2007 Author Share Posted December 9, 2007 Thanks to everyone. Every piece of advice was welcomed! Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410501 Share on other sites More sharing options...
dsaba Posted December 9, 2007 Share Posted December 9, 2007 you don't have to use heredoc syntax.... double quotes should do the trick in echoing variables within html code/strings $var = 'hello world'; echo "<b> $var </b>"; if mixing actual code and not just variables within strings you can try concacetantion echo '<b>'.strtolower('HELLO WORLD').'</b>'; single quotes: 'string'.code.'string'.code.'string' 'string'.code double quotes: "string".code."string".code."string" "string".code Quote Link to comment https://forums.phpfreaks.com/topic/80852-html-code-right-smack-in-the-middle-of-php-code/#findComment-410513 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.