Hola a tod@s.
Me estoy volviendo loco con una cosa que ya he hecho mil veces y que no sé porqué no me funciona.
He creado un formulario con el dreamweaver de insertar datos en una bd mysql y una vez que le doy a aceptar me pega un petardazo. El código no está tocado, está tal cual lo pone el dreamweaver y es el siguiente:
Código:
<?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_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO cliente (cif, nombre, telefono, email) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['cif'], "text"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['telefono'], "int"),
GetSQLValueString($_POST['email'], "text"));
mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($insertSQL, $conexion) or die(mysql_error());
}
?>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Cif:</td>
<td><input type="text" name="cif" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Nombre:</td>
<td><input type="text" name="nombre" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Telefono:</td>
<td><input type="text" name="telefono" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Email:</td>
<td><input type="text" name="email" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Insertar registro"></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
Una vez que le doy a Aceptar...revienta:
Error CGI
La aplicación CGI especificada puede comportarse de forma anormal si no recibe un conjunto completo de encabezados HTTP.
Seguro que es una tontería, pero no lo veo compis.
A ver si alguien puede echarme una mano.
Muchas gracias!!!