use isset to prevent undefined index