ashishyadav26 Posted November 7, 2012 Share Posted November 7, 2012 Hi All, I've been trying to follow the tutorial from http://www.w3schools.com/php/php_includes.asp but the example 2 displays the echo command on page rather then parsing the include file. ---------------------------------------- echo 'Home Tutorials References Examples About Us Contact Us'; Welcome to my home page. Some text. ---------------------------------------- What could be wrong? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/ Share on other sites More sharing options...
Beeeeney Posted November 7, 2012 Share Posted November 7, 2012 Hi All, I've been trying to follow the tutorial from http://www.w3schools...hp_includes.asp but the example 2 displays the echo command on page rather then parsing the include file. ---------------------------------------- echo 'Home Tutorials References Examples About Us Contact Us'; Welcome to my home page. Some text. ---------------------------------------- What could be wrong? Thanks in advance. Where are you including anything? Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390757 Share on other sites More sharing options...
ashishyadav26 Posted November 7, 2012 Author Share Posted November 7, 2012 Like this "menu.php": echo '<a href="/default.php">Home</a> <a href="/tutorials.php">Tutorials</a> <a href="/references.php">References</a> <a href="/examples.php">Examples</a> <a href="/about.php">About Us</a> <a href="/contact.php">Contact Us</a>'; ------------------- inclde-ex.php -- <html> <body> <div class="leftmenu"> <?php include 'menu.php'; ?> </div> <h1>Welcome to my home page.</h1> <p>Some text.</p> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390758 Share on other sites More sharing options...
Beeeeney Posted November 7, 2012 Share Posted November 7, 2012 Like this "menu.php": echo '<a href="/default.php">Home</a> <a href="/tutorials.php">Tutorials</a> <a href="/references.php">References</a> <a href="/examples.php">Examples</a> <a href="/about.php">About Us</a> <a href="/contact.php">Contact Us</a>'; ------------------- inclde-ex.php -- <html> <body> <div class="leftmenu"> <?php include 'menu.php'; ?> </div> <h1>Welcome to my home page.</h1> <p>Some text.</p> </body> </html> Have you tried putting PHP tags around your PHP code? Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390761 Share on other sites More sharing options...
ashishyadav26 Posted November 7, 2012 Author Share Posted November 7, 2012 @Beeeeney yes it worked but it's on w3schools site, anyway thanks a lot. Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390765 Share on other sites More sharing options...
trq Posted November 7, 2012 Share Posted November 7, 2012 w3schools is a terrible site to attempt to learn anything from. http://w3fools.com/ Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390767 Share on other sites More sharing options...
ashishyadav26 Posted November 7, 2012 Author Share Posted November 7, 2012 w3schools is a terrible site to attempt to learn anything from. http://w3fools.com/ Thanks got the idea. Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390825 Share on other sites More sharing options...
Muddy_Funster Posted November 7, 2012 Share Posted November 7, 2012 I found tiztag.com to be fairly decent for basic tut's Quote Link to comment https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390839 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.