Include command provides the opportunity to include several php pages within a single page. This feature facilitates us to save our time. Include takes a file name and simply inserts into the mentioned file.
It is very useful in the sense that if you want to put a menu or similar thing in every web-page then you can use Include, and whenever you need to make any changes into the menu, just modify the actual file and the changes will be shown in every single web page.
Let's consider an example of that we have two examples of chat and mail system and we want to put these links in each page:
mail.php is the file for mailing purpose and chat.php is for online chatting purpose.
Now write the following syntax in the file which will serve as the link to the multiple pages (in this case let's consider name of the file is phpLink.php):
<a href="chat.php">Chat</a>|<a href="mailPhp.php">Mail</a>
Now to get this links in every desired page, all we have to write is:
To include the links all we have to type the above code in desired files.
We have 1000s of tutorials on our website. Search Tutorials tutorials on our website.
Posted on: December 17, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles