Jump to content

Notice: Undefined index


mcrackin

Recommended Posts

You are getting that error because your error reporting is set to a high threshold, which it should be for developing purposes. But, they would be lower in production.

 

When you try to reference a variable that doesn't exist - it is an undefined variable or, in this case, you may be referencing the index of an array where the array exists but the index does not. For example:

if($_SESSION['msg']['reg-err'])

 

If that session value has not been set that if() statement would generate that error. TI don't know what the intent was for that condition. If the intent was to check if the variable was set, then you should use

if(isset($_SESSION['msg']['reg-err']))

 

But if the intent was to check if the value was not false, then you should first check if the variable is set, then check if it is not false.

if(isset($_SESSION['msg']['reg-err']) and $_SESSION['msg']['reg-err'] != false)

 

In a production environment set to a lower error reporting threshold, that code would probably work just fine, but it is poor coding practice. But, looking at that tutorial, I would suggest finding a better one.

If you post what's going on then we'll be glad to help.

 

Have you checked your mail logs for errors? If you are on linux it should be in /var/log/messages or /var/log/maillog. Not sure about windows though.

 

If it's a PHP error go ahead and post that. If you think the script is being executed but mail is just not being sent without an error make sure the mail function is indeed being executed and check the logs for errors.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.