Blank page after post
| From: | Digital Hit Entertainment | Date: | Thu, 10 Aug 2000 00:34:09 +0000 |
| Subject: | Blank page after post | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-1701@lists.php.net to get a copy of this message | ||
I've been having a wonderful struggle these last few days with
vservers.com over a database problem.
Originally I was getting the SQLConnect error messages and I was able to
pass those on. After a couple of days they replied that the problem had
been fixed.
The page we use to insert news into the database uses inserts the data
(using the $PHP_SELF action) and then presents the empty form again for
the next story.
After telling us it was fixed I was able to successfully insert a story.
When I went to go use the form later, it not only won't insert the data,
but after being unsuccessful IIS dishes up an empty page (nothing
between the <html> tags) despite having the name of the form page in the
address bar.
The script has been working fine for over a month and has not been
changed.
Ignoring the fact that vservers.com is still having a problem with the
database connection, can anyone explain why IIS would toss up an empty
page? Even when we were getting the MS SQL 7 error messages, the form
would still reload, so I don't get this latest quirk. I'll include the
code (can't remember where I adapted it from) below. If you're wondering
about the str_replace and stripslashes lines, it's a kludge we needed
because of the way vservers have the php.ini set:
<?php
if ($REQUEST_METHOD == 'POST') {
$cnx = odbc_connect( 'blah' , 'blah', 'pwd' );
$sql="INSERT into news VALUES ('$date', '$headline',
'$description', '$keywords', '$photo', '$alt',
'$celebs',
'$story')";
$sql = str_replace("\'","''",$sql);
$sql = stripslashes($sql);
$res = odbc_exec($cnx, $sql);
if ($some_error) {
echo "Oops!<br>";
exit;
}
else
echo "<a href=cronkite3.php3>Again?</a>";
}
?>
<form action="<?php ECHO $PHP_SELF ; ?>" method="POST">PLEASE
<br />
Date:(yyyy-mm-dd)<input type="text" name="date" size="12"
maxlength="20" value="2000-" /><br />
Headline: <input type="text" name="headline" size="50"
maxlength="200" value="Headline " /><br />
Description: <input type="text" name="description" size="50"
maxlength="200" /><br />
Keywords: <input type="text" name="keywords" size="50"
maxlength="200" /><br />
Make sure you start photo dir with / root.<br />
Photo: <input type="text" name="photo" value="none"
size="50"
maxlength="100" /><br />
Alt: <input type="text" name="alt" value="none" size="50"
maxlength="100" /><br />
People mentioned: <input type="text" name="celebs" size="50"
maxlength="400" value="Celebrity_Names" /><br />
<a
href="javascript:ReplaceText('<b>','</b>')">
<b>Bold</b></a>
<a
href="javascript:ReplaceText('<i>','</i>')">
<i>Italic</i></a>
<a
href="javascript:ReplaceText('<a
href="">','</a>')"> Link
<a
href="javascript:ReplaceText('&quot;','&quot;')">
Quotation</a>
<a
href="javascript:ReplaceText('<p>','</p>')">
Paragraph</a><br />
Story:<br />
<textarea name="story" rows="10" cols="100"
wrap="virtual"></textarea><br />
<input type="SUBMIT" value="Insert Data" /><input
type="RESET"
value="Reset" /><br />
</form>
</body>
--
Ian Evans