Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/05/2008, 15:37
marcvilap
 
Fecha de Ingreso: mayo-2008
Ubicación: Barcelona
Mensajes: 249
Antigüedad: 16 años
Puntos: 1
Busqueda Saltar a otra pagina

Buenas que tal, tengo una dudilla. Tengo este codigo que introduce unos campos en una BBDD. Lo que quiero es que una vez se almacene esta inforamción, el php nos envie a una pagina llamada agradecimientos.php


CODIGO


<?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 animales (id_perro, `nombre`, area,
VALUES (%s, %s, %s)",

GetSQLValueString($_POST['id_perro'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['area'], "text"));

mysql_select_db($database_infoper, $infoper);
$Result1 = mysql_query($insertSQL, $infoper) or die(mysql_error());
}
?>