All of a sudden a page which hasn’t been changed since February 19/12 is no longer working and I can’t figure out why. It’s a form and is now returning the error:
“CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.”
This is an untouched file which has been working perfectly. A slightly revised copy of the file is still working fine. I’ve compared the code between the 2 files and can’t find anything different (other than the few words on the page which are different - nothing to do with the form fields, which are identical).
This is the file which doesn’t work (it’s at http://www.caninereview.ca/directory_listing_order.php):
<?php require_once(‘Connections/db9568.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”] == “form2”)) {
$insertSQL = sprintf(“INSERT INTO people (firstName, lastName, cityName, provName, countryName, phoneNumb, emailAddy, kennelName, breedName, website, Show_Hide, Directory_Listing) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)”,
GetSQLValueString($_POST[‘firstName’], “text”),
GetSQLValueString($_POST[‘lastName’], “text”),
GetSQLValueString($_POST[‘cityName’], “text”),
GetSQLValueString($_POST[‘provName’], “text”),
GetSQLValueString($_POST[‘countryName’], “text”),
GetSQLValueString($_POST[‘phoneNumb’], “text”),
GetSQLValueString($_POST[‘emailAddy’], “text”),
GetSQLValueString($_POST[‘kennelName’], “text”),
GetSQLValueString($_POST[‘breedName’], “text”),
GetSQLValueString($_POST[‘website’], “text”),
GetSQLValueString($_POST[‘Show_Hide’], “text”),
GetSQLValueString($_POST[‘Directory_Listing’], “text”));
mysql_select_db($database_db9568, $db9568);
$Result1 = mysql_query($insertSQL, $db9568) or die(mysql_error());
$insertGoTo = “CRcart/directory_listing_pic.php”;
if (isset($_SERVER[‘QUERY_STRING’])) {
$insertGoTo .= (strpos($insertGoTo, ‘?’)) ? “&” : “?”;
$insertGoTo .= $_SERVER[‘QUERY_STRING’];
}
header(sprintf(“Location: %s”, $insertGoTo));
}
mysql_select_db($database_db9568, $db9568);
$query_rsBreedList = “SELECT breedCode, breedName FROM breeds ORDER BY breedName ASC”;
$rsBreedList = mysql_query($query_rsBreedList, $db9568) or die(mysql_error());
$row_rsBreedList = mysql_fetch_assoc($rsBreedList);
$totalRows_rsBreedList = mysql_num_rows($rsBreedList);
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=UTF-8” />
<meta name=“keywords” content=“Canine Review Dog Magazine, dog shows, obedience, agility, rally-o, veterinarian advice, dog magazine, kennels, judges, dog shows, kennel clubs, Top Dogs, purebreds” />
<meta name=“description” content=“Canine Review magazine is Canada’s oldest independent competitive dog show magazine. It was the first Canadian dog show entity to have a presence on the internet and now we’re reaching out to the world as the first dog show entity on mobile devices” />
<link href=“css/CR-2012.css” rel=“stylesheet” type=“text/css” />
<title>Canine Review Magazine - Directory Listing Order Form</title>
<script src=“SpryAssets/SpryValidationTextarea.js” type=“text/javascript”></script>
<script src=“SpryAssets/SpryValidationTextField.js” type=“text/javascript”></script>
<link href=“SpryAssets/SpryValidationTextarea.css” rel=“stylesheet” type=“text/css” />
<link href=“SpryAssets/SpryValidationTextField.css” rel=“stylesheet” type=“text/css” />
</head>
<body>
<?php include(“_includes/header.php”); ?>
<div id="order-directory">
<form id="DirOrderForm" name="Directory Order Form" method="post" action="">
<h4>Enter the information for your FREE listing here. Contact your breed club to have then add a listing too!</h4>
</form>
<form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>First Name*:</p></td>
<td nowrap="nowrap"><p>
<input name="firstName" type="text" value="" size="40" maxlength="50" />
**Last Name*:*
<input name="lastName" type="text" value="" size="40" maxlength="50" />
</p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>City*:</p></td>
<td nowrap="nowrap"><p>
<input name="cityName" type="text" value="" size="30" maxlength="30" />
**Province/State*:
<input name="provName" type="text" value="" size="20" maxlength="30" />
*Country*:
<input name="countryName" type="text" value="" size="30" maxlength="30" />
*</p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>Phone Number:</p></td>
<td><p>
<input name="phoneNumb" type="text" size="30" maxlength="30" />
**E-mail Address*:
<span id="spryEmailDir">
<input name="emailAddy" type="text" id="spryEmail" size="50" maxlength="50" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span> </p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>Kennel Name*:</p></td>
<td><p>
<input name="kennelName" type="text" size="50" maxlength="50" />
**Breed*:
<select name="breedName" id="BreedList">
<?php
do {
?>
<option value="<?php echo $row_rsBreedList['breedName']?>"><?php echo $row_rsBreedList['breedName']?></option>
<?php
} while ($row_rsBreedList = mysql_fetch_assoc($rsBreedList));
$rows = mysql_num_rows($rsBreedList);
if($rows > 0) {
mysql_data_seek($rsBreedList, 0);
$row_rsBreedList = mysql_fetch_assoc($rsBreedList);
}
?>
</select>
</p>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>Website:</p></td>
<td><p>http://
<input name="website" type="text" value="" size="100" maxlength="100" />
</p></td>
</tr>
<tr valign="baseline">
<td align="right" valign="top" nowrap="nowrap"><p>A few words about <br />
your kennel*<br />
(500 characters max):</p></td>
<td>
<p><span id="spryDirectoryListing">
<textarea name="Directory_Listing" id="spryDirListing" cols="100" rows="5"></textarea>
<span id="countsprytextarea1"> </span><span class="textareaRequiredMsg">A value is required.</span><span class="textareaMaxCharsMsg">Exceeded maximum number of characters.</span></span> </p></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right"><p>* Indicates required field*</p></td>
<td><p>After you
click "Submit Information" you will be taken to <br />
a form where you can pay for and send a photo or logo if you so choose*
<input type="submit" value="Submit Information" />
</p></td>
</tr>
</table>
<input type="hidden" name="Show_Hide" value="Y" />
<input type="hidden" name="MM_insert" value="form2" />
</form>
<p> </p>
<!-- order-directory --></div>
<?php include(“_includes/footer.php”); ?>
<script type=“text/javascript”>
var sprytextarea1 = new Spry.Widget.ValidationTextarea(“spryDirectoryListing”, {maxChars:500, counterId:“countsprytextarea1”, counterType:“chars_remaining”, validateOn:[“blur”]});
var sprytextfield1 = new Spry.Widget.ValidationTextField(“spryEmailDir”, “email”, {validateOn:[“blur”]});
</script>
</body>
</html>
<?php
mysql_free_result($rsBreedList);
?>
When I hit the submit button, not only do I get the CGI error mentioned above but the url bar changes to read http://caninereview.ca/directory_listing_order.php/directory_listing_order.php? instead of going to the specified page ( $insertGoTo = “CRcart/directory_listing_pic.php”;), which works perfectly on the _CLUB version of the page.
Can anyone see what the problem could be?