I’m still struggling trying to get my forms to behave. I thought I had it solved with the offlist help of one of the form members but even the form which worked with his help is now broken. I’ve started from scratch, using the DW form wizard and not touching it AT ALL, just uploading it to the server and filling it out. When I hit send I get the same CGI error as before. When I look in the url bar the name of the form has been duplicated. When I view the source code, sure enough, the name of the form is duplicated.
As far as I can figure (with the help of our server tech support) this is the offending code - generated by DW!! - and I think it’s the first 3 lines which are causing the problem:
$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 groomers (shopName, groomPropName, groomStreet, groomCity, groomProvince, groomCountry, groomPhone, groomEmail, groomWebsite, groomListing, groomPic, groomShow_Hide) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)”,
GetSQLValueString($_POST[‘shopName’], “text”),
GetSQLValueString($_POST[‘groomPropName’], “text”),
GetSQLValueString($_POST[‘groomStreet’], “text”),
GetSQLValueString($_POST[‘groomCity’], “text”),
GetSQLValueString($_POST[‘groomProvince’], “text”),
GetSQLValueString($_POST[‘groomCountry’], “text”),
GetSQLValueString($_POST[‘groomPhone’], “text”),
GetSQLValueString($_POST[‘groomEmail’], “text”),
GetSQLValueString($_POST[‘groomWebsite’], “text”),
GetSQLValueString($_POST[‘groomListing’], “text”),
GetSQLValueString($_POST[‘groomPic’], “text”),
GetSQLValueString($_POST[‘groomShow_Hide’], “text”));
mysql_select_db($database_db9568, $db9568);
$Result1 = mysql_query($insertSQL, $db9568) or die(mysql_error());
$insertGoTo = “CRcart/directory_list_logo.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$insertGoTo .= (strpos($insertGoTo, ‘?’)) ? “&” : “?”;
$insertGoTo .= $_SERVER[‘QUERY_STRING’];
}
header(sprintf(“Location: %s”, $insertGoTo));
Why on earth would a DW wizard generate code which throws up a CGI error?! The exact error is: CGI Error - The specified CGI application misbehaved by not returning a complete set of HTTP headers.
In case it helps, this is the form action line: <form action=“<?php echo $editFormAction; ?>” method=“post” name=“form1” id=“form1”>