Jump to content

File Include Error


ashishyadav26

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/270408-file-include-error/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390757
Share on other sites

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>

Link to comment
https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390758
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/270408-file-include-error/#findComment-1390761
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.