Client LoginView your Shopping CartHelp & Frequently Asked QuestionsEmail Us
Home Services Portfolio Web Design Pricing Dreamweaver Templates Web Applications Free Tutorials About Contact Us
Services > CSS Web Design | Professional Logo Design | ASP.net, ASP & PHP Programming | Flash Animation & Programming | Reliable Web Hosting | Website Maintenance
Portfolio > Web Design Portfolio | Web Programming Portfolio | Logo Design Portfolio | Web Design Pricing > Custom Web Design | Logo Design | Business Card Design
Free Web Design Guide > Website Design w/ Dreamweaver & Fireworks | Adobe Fireworks CS4 review | Photo Effects | Text Effects | Graphic Design Ideas | Web Design Ideas
Website Navigation Ideas | CSS Styles Tutorial | Dreamweaver Template | Server Side Includes | Flash Tutorials > Flash Effects | Flash Sound Button | Sound On/Off Button
Flash Preloader | Import External Data | Promotion > SEO Tips | Google Tips & Page Rank | JavaScript > Date Validation | Email Validation | Phone Validation | Tip Boxes

PHP Server Side Includes

In this tutorial you will learn about Server-side Includes, how to include a file, PHP common code for Linux, Unix and Windows, retrieving form variables in PHP.

How to include a file in PHP

Include file is a common feature of all Server-side languages and technologies. Include file can be used to include one file into another file. This will simplify the maintenance of a web site.

Syntax:

include("Path of the file");

Example

include("conn.php");

Getting PHP & Form variable in different operating system

Why Windows code does not working in Linux and Unix or Linux code does not working in Windows and Unix.

This is the most frequently asked question in PHP. While running a PHP document in Windows we get the form variable by either GET or POST method. For which we use the following code:

$name=$_POST["txtName"]; or $name=$_GET["txtName"];

While using the same code in Linux and Unix you will get a error message. To solve this problem or to run a PHP page in a different operating system without any errors, first declare the GET variables and POST variables globally using the following code.

<?php
if (isset($HTTP_POST_VARS)){
while(list($name,$value)= each($HTTP_POST_VARS))
{
$$name=$value ;
}
}
if (isset($HTTP_GET_VARS)){
while(list($name,$value)= each($HTTP_GET_VARS))
{
$$name=$value ;
}
}
if (isset($HTTP_SERVER_VARS)){
while(list($name,$value)= each($HTTP_SERVER_VARS))
{
$$name=$value ;
}
}
if (isset($_FILES)){
while(list($name,$value)= each($_FILES))
{
$$name=$value ;
}
}
if (isset($_SERVER)){
while(list($name,$value)= each($_SERVER))
{
$$name=$value ;
}
}
?>

Use this code in every page or declare it in the common page and include the common page in every other PHP page.

Absolutely FREE Web Templates
Check out these quality free web templates and download them without any registration or sign-up!

FREE Web Design Guide
From web design tips & ideas to HTML, CSS Styles, Fireworks & Dreamweaver you'll find all you need to know about effective web site design right here!

Quality Dreamweaver Templates
Professional quality dreamweaver templates in over 20 categories, starting at just $9.95! Instant download & easy customization

Beauty Templates | Business Templates | Christian Templates | CSS Templates | Education Templates | Family Templates | Flash Templates | Free Dreamweaver Templates
Food Templates | General Templates | Government Templates | Health/Medical Templates | Hi-Tech Templates | Kids/Childcare Templates | Low-cost Budget Templates
Personal Templates | Pets Templates | Photography Templates | Profession Templates | Real Estate Templates | Sports Templates | Telecom Templates | Travel Templates
Free Tutorials > Web Design Tutorials | CSS Web Design | Fireworks Tutorials | Dreamweaver Tutorials | Flash Tutorials | SEO Tutorials | Javascript Tutorials | PHP Tutorials