Ho un form che una volta compilato passa i dati ad una pagina che li inserisce nel db.
Il problema è che anzichè agigungere un solo record con i dati ricevuti dal form, ne inserisce due identici.
Qui il codice di inserimento:
codice:
$action = $_GET['action'];
switch ($action){
case 1: #LA VARIABILE CHIEDE DI INSERIRE I DATI NEL DB
$adm_nome = $_POST['adm_nome'];
$adm_username = $_POST['adm_username'];
$adm_psw = $_POST['adm_psw'];
$adm_type = $_POST['adm_type'];
$status = $_POST['status'];
include("connesisone_db.php");
$insert_admin = "INSERT INTO d_admin (adm_nome, adm_username, adm_psw, adm_type, status) VALUES ('" . $adm_nome . "', '" . $adm_username . "', '" . $adm_psw . "', '" . $adm_type . "', '" . $status . "')";
mysql_query($insert_admin,$conn);
mysql_close($conn);
print ("<h2><img src=\"../images/info.gif\" alt=\"\" />DATI AGGIUNTI CORRETTAMENTE
");
print ("<a href=\"new_admin.php\">Aggiungi</a> un'altro admin
<a href=\"../main.php\">Home</a></h2>");
break;
}
Io non vedo errori nel codice. Sta di fatto che vengono creati due record identici.
Avete idea del come mai?
Thanks