ciao a tutti ho un dubbio che non sono riuscito a risolvere neanche cercando nel forum.

vi spiego brevemente il mio problema

utente.html con form annesso
action="insertUtente.php"
onSubmit="funzione js per la validazione del form"

invece insertUtente.php è questo:

Codice PHP:
<?php 
mysql_connect
("localhost""root""");
mysql_select_db("db305862") or die ("*** Attenzione, non trovo il database");

$query="select max(id_usr) from utente";
$res=mysql_result(mysql_query($query),0);

$id_utente=$res+1;
$username=$HTTP_POST_VARS["username"];     
$password=$HTTP_POST_VARS["password"];
$fullname=$HTTP_POST_VARS["fullname"];
$mail=$HTTP_POST_VARS["mail"];
$av=$HTTP_POST_VARS["avvisi"];

$query "select * from utente where username = '$username'";
$user=mysql_fetch_row(mysql_query($query)); // Restituisce un array che corrisponde ad una riga caricata oppure FALSE  se non ci sono più righe

if($user){
   echo(
"Username già utilizzato cambiarlo");
   include(
"utente.html"); // QUI VORREI RICARICASSE IL FORM CON I DATI GIA' COMPILATI NON CHE LO RICARICASSE CANCELLANDO TUTTO
}
else{
   
$query "insert into UTENTE(id_usr, username, password, fullname, email,avvisi) values('$id_utente', '$username', '$password', '$fullname', '$mail', '$av')";
  
$res  =  mysql_query($query);
  if (!
$res) {    echo "Attenzione, ci sono stati dei problemi, riprova più tardi\n</td>/tr></table>"
exit;
}         else echo 
"inserito";     } ?>
Io vorrei che dove c'è l'include ricaricasse il form html con i dati che l'utente aveva già inserito magari non la password + il messaggio di errore.

Qualcuno saprebbe darmi una mano? Anche con una soluzione che si possa avvicinare a questa!
grazie mille!