Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undefined variable 1

Status
Not open for further replies.

akelabanda

Programmer
Dec 19, 2001
61
IN
Hi there

I've setup a readymade website on my Win XP. It's running Apache 2.2 and PHP5.

When I run index.php, there is an error displayed

Notice: Undefined variable: auto_filename in F:\ on line 154

index.php has the following line
<? include("includes/vars.inc") ?>

includes/vars.inc contains php variable
$auto_filename = 'auto.txt';

After looking at a couple of answers, I've also set
register_globals = On in php.ini

Can you please help ?

Thanks
Rajeev

UK's best mobile deals online
 
first, set register globals to off. read the manual on the security implications of this.

next, check that vars.inc is enclosed within the normal <?php ... ?> tags. include() will not evaluate the code unless it is within tags.

you, of course, must put the include command above the lines in which you use the variables that are set within.

you also have not provided us with line 154 and its surrounding code so we can't tell if anything is amiss.
 
the newer installs of php seem to come with allow short tags turned off in php.ini. i assume this is for xml compatibility.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top