trouble with variables in an include file
Posted: Mon Jun 28, 2010 6:30 pm
I keep having trouble with Apache/PHP recognizing variables in my include() file.
Thus I have a program that has this structure:
And aFile looks like this pattern:
These seem to work fine for me. But the parallel setup--as nearly as I can see--in my program gives the "undefined variable" error message in the Apache log:
What kinds of things might be causing this problem? I've already moved my include() below where I extract the variables from $_POST--so I'm sure the variables are declared and have value before the include() file would use them--but that doesn't seem to have helped.
Thus I have a program that has this structure:
Code: Select all
<?php
$campaignNo = '22222';
include('aFile');
?>Code: Select all
<?php
//for example
echo $campaignNo;
?>The supposedly guilty lines are[Mon Jun 28 17:39:05 2010] [error] [client ...] PHP Notice: Undefined variable: campaignNo in ...misc_DirMsg.php on line 38
I don't get an error when I put these lines into aFile, as nearly as I can tell.$Signer_fileName = "signup_csv/".$campaignNo.".csv";
$Target_fileName = "target_csv/".$campaignNo.".csv";
What kinds of things might be causing this problem? I've already moved my include() below where I extract the variables from $_POST--so I'm sure the variables are declared and have value before the include() file would use them--but that doesn't seem to have helped.