I am getting error message :
undefined index:
in my code. Below is the function on the line
if($user['flagged'] == 1){
    $flag = "Your last payment has been flagged as NOT RECEIVED.";
}
 it says  Undefined index: flagged 
How can this be fixed
I am getting error message :
undefined index:
in my code. Below is the function on the line
if($user['flagged'] == 1){
    $flag = "Your last payment has been flagged as NOT RECEIVED.";
}
 it says  Undefined index: flagged 
How can this be fixed
 
    
    Just check if msg index of global array $_GET is set. For example
if(isset($_GET['msg']) && $_GET['msg']==="success")
I think it will solve your problem.
 
    
    use isset() to check it first
if(isset($_GET['msg']) && $_GET['msg']==="success"){
    $log_prompt = '<span style="color:red">You Have successfully registered. Login Now!</span>';
}
if the first condition isset($_GET['msg']) returned false, it will escape the second part of the if condition and will not print your message.
read more about Logical Operators
 
    
    When you load the page the URL must me something like this:
localhost/your_page.php?msg=something_value
But your app mustn't return error when in URL there isn't ?msg=value... You have to use isset()
if(isset($_GET['msg']) && $_GET['msg'] == "success")
=== is recommended
if(isset($_GET['msg']) && $_GET['msg'] === "success")
More info: http://php.net/manual/en/language.operators.logical.php
