Web Hosting Talk







View Full Version : CGI Error


AC1
09-18-2002, 04:09 PM
Hi

The code below works OK on my live unix server but not on my windows PC. I am running mysql, php and iis.

The first screen works correctly and retrieves the data from the dbase and displays it on the screen, but when I select the required option from the list and the 2nd screen is called I get the following error message:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:

The rest of the screen is then blank.

Any ideas?

Cheers
Andy

<?

include("dbinfo.inc.php");

mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die("unable to select database");

?>

<center><h2> IT and Computing Free Courses</h2></center>

<blockquote>
<?

// Request the text of all the subjects

$result = @mysql_query("SELECT subject_no, subject FROM subject where area_no = 1");
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}

// Display the text of each subject record on a separate line

while ( $row = mysql_fetch_array($result)) {
$subject=$row["subject"];
$subject_no=$row["subject_no"];

$option_block .="<option value=$subject_no>$subject</option>";
}


//it_courses.php?subject_no=$subject_no
?>
</blockquote>

<form method="post" action="it_courses.php">
<p>Please select the required subject:<br>
<select name="subject_no">

<? echo "$option_block"; ?>

</select>
<p><input type="submit" value="Find Courses"></p>

</form>

frostie
09-18-2002, 07:43 PM
Well code works out fine. What is happening is that the code is being parsed by your CGI intepreter and not your PHP intepreter and hence why it is giving an error. Becuase it cannot read what you have put. Sounds like the server config is wrong somewhere. Where exactly I cannot say.

James