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

ErrorException: Undefined index: known

AndyB

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

PHP:
					// 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:

PHP:
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.