Foros del Web » Programando para Internet » PHP »

Error CGI

Estas en el tema de Error CGI en el foro de PHP en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 09/03/2011, 12:26
 
Fecha de Ingreso: enero-2008
Mensajes: 27
Antigüedad: 16 años, 3 meses
Puntos: 0
Error CGI

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">&nbsp;</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!!!

Etiquetas: cgi
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:37.