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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

undefined variable error

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
CA
Hi All,

I have a file that sets a variable and then I call a function from an include file to print a form to the browser. Yet when I do this I get an undefined variable error:
Warning: Undefined variable: distribName in common.php on line 30

Page1.php

if(!isset($distribname)){
$distribName ="";

include common.php

<input type=\&quot;text\&quot; name=\&quot;DistribName\&quot; size=\&quot;30\&quot; value = \&quot;&quot; & $distribName & &quot;\&quot;>

There are about 13 variable like this and I can't seem to get this fixed. Any help will be appreciated.

TIA

Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
I am assuming that the code works? I believe that PHP variables do need to be defined. You can switch the error logging to a different level to show only Fatel errors (errors that stop the code running) The error you are recieving is a warning and I don't believe will affect the program.

To look at the error logging open php.ini and look for the lines:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Below will tell you more about what errors you wish to show

Marcus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top