Jump to content

quick error question

Go to solution Solved by BrodaNoel,

Recommended Posts

hi bin getting this undefined variable notice and i was just wondering what it meant, because everything is working the way i want it to but getting this notice at the bottom is getting a bit stupid


( ! ) Notice: Undefined variable: errors in C:\wamp\www\AddLeads\addeadstemplate.php on line 99Call Stack#TimeMemoryFunctionLocation10.0000158288{main}( )..\addeadstemplate.php:0


this is the section its in 


if (count($errors)==0) 


  $con = mysqli_connect("localhost","root","","nib");
  // Check connection
  if (mysqli_connect_errno())
	echo "Failed to connect to MySQL: " . mysqli_connect_error();

  $sql="INSERT INTO tbl_club_contacts (CompanyName, FirstName, Address1, Address2, Area, City) VALUES ('$_POST[companyname]','$_POST[firstname]','$_POST[address1]','$_POST[address2]','$_POST[area]','$_POST[city]')";

  if (!mysqli_query($con,$sql))
   die('Error: ' . mysqli_error($con));
   echo "record added";

} // end if $errors == 0

Link to comment
Share on other sites

  • Solution

It's simple.

The "warning" (is not an error) say: "The $errors is not defined"

So.. The $errors is not defined... It not have a value.


If you use a var without a value, or not defined, you will see a warning.


In the top of you site, add this line:

$errors = '';

So, $errors will have a value...


But, dont worry, is only a warning... not an error.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.