ho fatto così però continua a dirmi sempre "centro già presente"
Codice PHP:
<?
if ($pagina==1){
$sql = "SELECT id_centri FROM b_centri where nome_centro='$nome_centro' AND telefono_centro='$telefono_centro'";
$result = mysql_query($sql,$conn);
$row =mysql_num_rows($result);
if ($row>0){
$msg = "centro già presente";
} else {
$sql = "INSERT INTO b_centri (nome_centro, telefono_centro)
VALUES ('$nome_centro', '$telefono_centro')";
mysql_query($sql, $conn) or die ($sql);
$msg = "contatto inserito nel database";
}
}
?>
Codice PHP:
<form name="form" action="<?=$PHP_SELF?>" method="post">
nome centro
<input type="text" name="nome_centro" size="18" maxlength="30">
telefono
<input name="telefono_centro" type="text" size="18" maxlength="30">
<input type="hidden" name="pagina" value="1"><input type="submit" class="pulsante" value="continua">
<?
if ($msg){?>
<span class="testo_rosso_bold">
<?=$msg?>
</span>
<?
}?>
</form>