• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

ErrorException: Undefined index: known


Well-known member
I have the following code in my Register Email add-on:

					// get location
					$tags = get_meta_tags('http://www.geobytes.com/IpLocator.htm?GetLocation&template=php3.txt&IpAddress=' . $ipAddress);

					// define location only if we have data
					if ($tags['known'] == 'true')
						$location = $tags['city'] . ', ' . $tags['region'] . ', ' . $tags['country'];
The following line:

if ($tags['known'] == 'true')
very rarely will produce a server error message. What is the proper way to code this so in case the index is undefined, it will not produce an error message?

Thank you.