ChrisMartino Posted November 1, 2009 Share Posted November 1, 2009 <p>Test hello <a href="products.php?action=samp" target="_blank"> <img src="http://www.sa-mp.com/images/logo.gif" border="0" alt="SA-MP Hosting" /> </a> </p> if ($action == samp) { <h1>Game Servers</h1> <p>Lorem ipsum dolor sit amet, <a href="#" title="link">link</a>, <a class="visited" href="#" title="visited link">visited link</a>, <a class="hover" href="#" title="hovered link">hovered link</a> consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallis ut, eros.</p> } <p> The PHP code just appears as text on the page? Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/ Share on other sites More sharing options...
redarrow Posted November 1, 2009 Share Posted November 1, 2009 opening tags and closing tags are not present are they? <?php // open php tag. ?> // closing php tag. Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-948871 Share on other sites More sharing options...
ChrisMartino Posted November 1, 2009 Author Share Posted November 1, 2009 But then i get this Parse error: syntax error, unexpected '<' in /home/chaosnz/public_html/test/products.php on line 80 Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-948930 Share on other sites More sharing options...
mikesta707 Posted November 1, 2009 Share Posted November 1, 2009 you need to surround your PHP code with PHP tags (<?php ?>) which line is line 80? repost updated code plz Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-948934 Share on other sites More sharing options...
ChrisMartino Posted November 2, 2009 Author Share Posted November 2, 2009 Ok, This time i get no errors but the code dose not work? http://pastebin.com/m5e245adb Please help . Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-948976 Share on other sites More sharing options...
ChrisMartino Posted November 2, 2009 Author Share Posted November 2, 2009 *bump Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-949062 Share on other sites More sharing options...
Jnerocorp Posted November 2, 2009 Share Posted November 2, 2009 try this: <p>Test hello <a href="products.php?action=samp" target="_blank"> <img src="http://www.sa-mp.com/images/logo.gif" border="0" alt="SA-MP Hosting" /> </a> </p> <?php $action = $_GET['action']; $samp = "samp"; if ($action == $samp) { ?> <h1>Game Servers</h1> <p>Lorem ipsum dolor sit amet, <a href="#" title="link">link</a>, <a class="visited" href="#" title="visited link">visited link</a>, <a class="hover" href="#" title="hovered link">hovered link</a> consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallis ut, eros.</p> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-949069 Share on other sites More sharing options...
ChrisMartino Posted November 2, 2009 Author Share Posted November 2, 2009 Yup that worked the treat, But is there any way i can stop it opening in a new browser and make it just open as if you were clicking a link in the nav bar?. Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-949197 Share on other sites More sharing options...
trq Posted November 2, 2009 Share Posted November 2, 2009 Yup that worked the treat, But is there any way i can stop it opening in a new browser and make it just open as if you were clicking a link in the nav bar?. Remove the _blank target? <a href="products.php?action=samp" target="_blank"> Quote Link to comment https://forums.phpfreaks.com/topic/179871-why-dose-this-not-work-code-appears-on-page-as-plain-text/#findComment-949202 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.