Include php file in another file?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
richie256
Forum Commoner
Posts: 37
Joined: Mon Oct 13, 2003 8:00 pm
Location: Montréal/Canada

Include php file in another file?

Post by richie256 »

Hi

I have a php file who is called by an another php... the second php file contain a switch and some function. There is no problem to call the functions from the main php, but the switch at the begining of the second php don't seem to be executed while called from the main php file.... do you think include is the good way to merge text?

main php file:

Code: Select all

<?php
include("dbcontrol.php");

(...)
?>
second php file:

Code: Select all

<?php
switch ($_GET['lang']) { 
    case 'fr': 
        $language='frmsg'; 
    break;
    case 'en': 
        $language='enmsg'; 
    break; 
    default: 
        $language='enmsg'; 
}

(...)
?>
User avatar
richie256
Forum Commoner
Posts: 37
Joined: Mon Oct 13, 2003 8:00 pm
Location: Montréal/Canada

Post by richie256 »

ok I have found my error... in a function, I was trying to call a global variable without declare it before... thanks!!
Post Reply