Estoy haciendo una aplicacion en dreamweaver. El problema que tengo es que al darle al boton de insertar, me guarda todos los datos que quiero guardar pero no se me va a ninguna pagina y la pagina se queda en blanco. No soy capaz de encontrar el fallo y no se lo que puede ser. Aqui os dejo un poco de codigo a ver si alguien puede ayudarme.
Código PHP:
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO datupertsonalak (NAN, IdPertsonala, Izena, Abizena1, Abizena2, JaiotzeData, IdSexua, Herrialdea, Helbidea, PostaKodea, Telefono1, Telefono2, Faxa, Emaila, InskripzioData, IdIkasketak, IdUdalerria) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString(strtoupper($_POST['NAN']), "text"),
GetSQLValueString($_POST['IdPertsonala'], "int"),
GetSQLValueString(ucfirst($_POST['Izena']), "text"),
GetSQLValueString(ucfirst($_POST['Abizena1']), "text"),
GetSQLValueString(ucfirst($_POST['Abizena2']), "text"),
GetSQLValueString($_POST['JaiotzeData'], "date"),
GetSQLValueString($_POST['IdSexua'], "int"),
GetSQLValueString(ucfirst($_POST['Herrialdea']), "text"),
GetSQLValueString(ucfirst($_POST['Helbidea']), "text"),
GetSQLValueString($_POST['PostaKodea'], "text"),
GetSQLValueString($_POST['Telefono1'], "text"),
GetSQLValueString($_POST['Telefono2'], "text"),
GetSQLValueString($_POST['Faxa'], "text"),
GetSQLValueString($_POST['Emaila'], "text"),
GetSQLValueString($_POST['InskripzioData'], "date"),
GetSQLValueString($_POST['IdIkasketak'], "int"),
GetSQLValueString($_POST['IdUdalerria'], "int"));
mysql_select_db($database_Datuak3, $Datuak3);
$Result1 = mysql_query($insertSQL, $Datuak3) or die(mysql_error());
$NAN = strtoupper($_POST['NAN']);
if (!empty($_POST["Tituloa"])){
$insertSQL = sprintf("INSERT INTO gizarprestaarau (IdPrestaArau, Tituloa, AmaieraData, Zentroa, NAN) VALUES (%s, %s, %s, %s, '$NAN')",
GetSQLValueString($_POST['IdPrestaArau'], "int"),
GetSQLValueString(ucfirst($_POST['Tituloa']), "text"),
GetSQLValueString($_POST['AmaieraData'], "date"),
GetSQLValueString(ucfirst($_POST['Zentroa6']), "text"),
GetSQLValueString(strtoupper('$NAN'), "text"));
mysql_select_db($database_Datuak3, $Datuak3);
$Result1 = mysql_query($insertSQL, $Datuak3) or die(mysql_error());
}
?>
Os agradeceria vuestra ayuda porque ya me estoy volviendo medio loco buscando el fallo.
Gracias de antemano y saludos!!!