Quel codice è un casino
[PHP]
In primi fai una cosa del genere
mysql_connect('localhost','root','') or die (mysql_error());
mysql_select_db('noteit') or die (mysql_error());
$check = false ;
$sub = $_POST['vai'] ;
if(!empty($sub))
{
$check = true ;
}

/*FALLO PER TUTTI
$nom = $_POST['nome'];
$cog = $_POST['cognome'];
$gg = $_POST['gg'];
$mm = $_POST['mm'];
$aaaa = $_POST['aaaa'];
$sex = $_POST['sesso'];
$cod1 = $_POST['codice1'];
$cod2 = $_POST['codice2'];
$email = $_POST['email'];
*/

if($check)
{
if($cod1==$cod2)
{
$sql = "SELECT * FROM utenti WHERE EMAIL = '".$email."'" ;
$rows = mysql_num_rows(mysql_query($sql)) ;
if($rows != 0)
{
die("email già esistente") ;
}
else