Ciao a tutti!

io ho questo controllo per verificare se i campi sono vuoti


codice:
<script language="javascript" type="text/javascript">

function check(){
if(document.netlounge.accetto.checked!=true){
	alert("Devi aver letto e accettato le condizioni di utilizzo");
}
else{
		errore1 = "Devi inserire il tuo nome";
		errore2 = "Devi inserire la tua mail";
		errore3 = "Devi inserire la tua data di nascita";
		errore4 = "Devi inserire il tuo CAP";
		errore5 = "Devi inserire il tuo numero di cellulare";
		errore6 = "Devi inserire la tua provincia";
		errore7 = "Devi inserire il tuo cognome";
		errore8 = "Devi inserire il codice della tua tessera";
		errore9 = "Devi inserire la tua città ";
		errore10 = "Devi inserire il tuo indirizzo";
		if (document.netlounge.nome.value.length ==0){alert(errore1);}
		if (document.netlounge.mail.value.length ==0){alert(errore2);}
		if (document.netlounge.nascita.value.length ==0){alert(errore3);}
		if (document.netlounge.cap.value.length ==0){alert(errore4);}
		if (document.netlounge.telefono.value.length ==0){alert(errore5);}
		if (document.netlounge.provincia.value.length ==0){alert(errore6);}
		if (document.netlounge.cognome.value.length ==0){alert(errore7);}
		if (document.netlounge.codice.value.length ==0){alert(errore8);}
		if (document.netlounge.citta.value.length ==0){alert(errore9);}
		if (document.netlounge.indirizzo.value.length ==0){alert(errore10);}
		else{vai();}
		}
}


function vai(){
document.netlounge.action="register.php";
document.netlounge.submit();
}
</script>


questi sono i miei campi


Codice PHP:
<form name="netlounge" method="POST">

<div id="campo_noh" style="float:left; width:830px; height:46px;"></div>

<div id="campo_neutro" style="margin-top:10px; margin-bottom:10px;"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="codice" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;" /></td>
  </tr>
</table>
</div>


<div id="campo_nome"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="nome" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>

<div id="campo_cognome"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="cognome" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>

<div id="campo_indirizzo"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="indirizzo" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>

<div id="campo_cap"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="cap" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>

<div id="campo_citta"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="citta" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>

<div id="campo_provincia"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="provincia" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>


<div id="campo_mail"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="mail" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;" value="<? 
    
    
if(isset($_POST['mail'])){ 
    
    echo 
$mail; }
    
    else {
        echo 
"";}
    
    
?>"/></td>
  </tr>
</table>
</div>


<div id="campo_telefono"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="telefono" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>


<div id="campo_nascita"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="nascita" type="text" class="scritte_form" style="float: left;
    border:0px;
    background: none;
    vertical-align: center;
    margin-left: 230px;
    height: 12px;
    width: 540px;"/></td>
  </tr>
</table>
</div>



<div id="campo_informativa">
<div id="interno_informativa" class="informativa">

<?php include("privacy/informativa.inc"); ?>

</div>
</div>

<div id="campo_privacy"><table width="830" height="25" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="230"><input name="accetto" type="checkbox" style="padding-left:215px;" value="checkbox" checked="checked"/></td>
    <td width="600" class="scritte_accetto">Dichiaro di aver letto e accettato l'informativa</td>
  </tr>
</table>
</div>


<div id="campo_invia"><input type="image" onClick="check()" src="images/registrazione/invia.png" />
</div>

</form>



se io non li compilo tutti mi avverte che un campo è null ma lo script continua e carica anche la pagina successiva cosa che non dovrebbe fare se un campo è vuoto....
dove sbaglio ?

Grazie