Aquí el cod:
Código Javascript:
Ver original
<?php require_once('Connections/conexion.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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_update"])) && ($_POST["MM_update"] == "form3")) { $updateSQL = sprintf("UPDATE ap_usuarios SET MODELO=%s, MARCA=%s, APARATO=%s, COD_APARATO=%s, GRUPO=%s, NUM_PRODUCTO=%s, REVISION=%s, FD=%s, NUM_SERIE=%s, DISTRIBUIDOR=%s, ASEGURADORA=%s, FECHA_COMPRA=%s, INICIO_GARANTIA=%s, FIN_GARANTIA=%s WHERE NUM_APARATO=%s", GetSQLValueString($_POST['MODELO'], "text"), GetSQLValueString($_POST['MARCA'], "text"), GetSQLValueString($_POST['APARATO'], "text"), GetSQLValueString($_POST['COD_APARATO'], "text"), GetSQLValueString($_POST['GRUPO'], "text"), GetSQLValueString($_POST['NUM_PRODUCTO'], "text"), GetSQLValueString($_POST['REVISION'], "text"), GetSQLValueString($_POST['FD'], "text"), GetSQLValueString($_POST['NUM_SERIE'], "text"), GetSQLValueString($_POST['DISTRIBUIDOR'], "text"), GetSQLValueString($_POST['ASEGURADORA'], "text"), GetSQLValueString($_POST['FECHA_COMPRA'], "date"), GetSQLValueString($_POST['INICIO_GARANTIA'], "date"), GetSQLValueString($_POST['FIN_GARANTIA'], "date"), GetSQLValueString($_POST['NUM_APARATO'], "int")); mysql_select_db($database_conexion, $conexion); $Result1 = mysql_query($updateSQL, $conexion) or die(mysql_error()); $updateGoTo = "menu3.php";///Aquí es donde quiero que me lleve después del update con la variable $num_aparato///// if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $num_aparato=$_GET['ID']; mysql_select_db($database_conexion, $conexion); $query_Recordset1 = "SELECT * FROM ap_usuarios where num_aparato = '$num_aparato'"; $Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <form method="post" name="form3" action="<?php echo $editFormAction; ?>"> <table width="100%"> <tr> <td>Aparato</td> <td><input name="APARATO" type="text" value="<?php echo $row_Recordset1['APARATO']; ?>" /></td> <td>Modelo</td> <td><input name="MODELO" type="text" value="<?php echo $row_Recordset1['MODELO']; ?>" /></td> <td>NºSerie</td> <td><input name="NUM_SERIE" type="text" value="<?php echo $row_Recordset1['NUM_SERIE']; ?>" /></td> </tr> <tr> <td>Marca</td> <td><input name="MARCA" type="text" value="<?php echo $row_Recordset1['MARCA']; ?>" /></td> <td>Cod/12Nc</td> <td><input name="NUM_PRODUCTO" type="text" value="<?php echo $row_Recordset1['NUM_PRODUCTO']; ?>" /></td> <td>Revisión</td> <td><input name="REVISION" type="text" /></td> </tr> <input type="hidden" name="MM_update" value="form3"> <input type="hidden" name="NUM_APARATO" value="<?php echo $row_Recordset1['NUM_APARATO']; ?>"> </table> </form> <?php mysql_free_result($Recordset1); ?>
Gracias y un saludo.