I am getting an undefined index error for this line:
$msg = $_GET['msg'];
if(array_key_exists('msg',$_GET)) { //Your Code }