Scusate se mi ripropongo ma ho la necessità di risolvere questo problema.
Ho tre file per l'autenticazione degli utenti che ho ridotto all'essenziale per comodità.
Il primo file mi ramanda al secondo per l'autenticazione dell'utente, se username e pwd sono esatti ritorna al primo file se, invece, l'username o la pwd sono errati mi rimanda al secondo file e mi stampa che l'username o la pwd sono errati:

Il problema è che al lancio del primo file mi viene visualizza il seguente notice:

Undefined variable: msg in C:............. on line 5


Il primo file (felice1.php) contiene questo:

Codice PHP:
<?php  session_start();
include 
'connect.php'
if (
$_SESSION['login_staff'] != "ok")  { 
    
header("Location: felice2.php");
    exit;
} else {
$_SESSION['setta'] = ""
?>

Ok hai inserito username e password in modo corretto
<? ?>

Il secondo file (felice2.php9 che viene richiamato felice1.php contiene questo:

Codice PHP:
<?php  session_start();
?>
<form name="form" method="post" action="felice3.php">
<? 
    
if ($msg != "") { LINEA 5 INCRIMINATA   
    
print "[b]$msg[/b]

"
;
} else {
    print 
"[b]Inserire username e password[/b]

"
;
}    
?>
Username
<input name="username" type="text" id="username" size="15" maxlength="20">
Password
<input type="password" name="password" size="15" maxlength="20">
<input name="Submit" type="submit" class="submit" value="login">
</form>
Il terzo file (felice3.php) contiene questo:
Codice PHP:

<?php session_start();
    
    include 
'connect.php'
    
$_SESSION['login_staff'] = "no";
    
$_SESSION['login_staff_utente'] = "";
    
$_SESSION['login_staff_tipo'] = "";    

    
$key "username = '" "$_POST[username]"' and password = '" "$_POST[password]"'";
    
$query mysql_query("SELECT * FROM utenti WHERE $key");
    
$num mysql_num_rows($query);
    
    if (
$num != 0) {
        
$row=mysql_fetch_array($query);
        
$_SESSION['login_staff'] = "ok";
        
$_SESSION['login_staff_utente'] = "$row[username]";
        
$_SESSION['login_staff_tipo'] = "$row[tipo]";
        
header("Location: felice1.php");
        exit;                 
    } else {
        
$_SESSION['login_staff'] = "no";
        
$_SESSION['login_staff_utente'] = "";
        
$_SESSION['login_staff_tipo'] = "";        
        
header("Location: felice2.php?msg=Username e/o password errati");
        exit;                 
    }
?>
come posso risolvere il problema