Solved

Document contains no data

Posted on 1997-11-04
2
161 Views
Last Modified: 2013-12-25
Please help me,
I wrote a cgi:

#!/usr/bin/perl

print "Content-type: text/html\n\n";

#full path
$file="/home/httpd/html/dane.html";

#require cgi-lib.pl
require "cgi-lib.pl";

&ReadParse;

#otwiera plik i dostawia do niego nowe dane
open(DB,">>$file");

#drukuje informacje
print DB "\n<B>$in{'name'}<BR>";
print DB "\n$in{'location'}</B><BR>";
print DB "\n$in{'comments'}<BR><HR>\n";

close DB;

And html file:

<html>
<head>
<title>Test</title>
</head>

<form method=post action="../cgi-bin/dane.pl">
Nazwa:<input name="name"><br>
Adres:<input name="location"><br>
<BR>Komentarz:<br>
<textarea name="comments">
</textarea>
<input type="submit">
</form>

<b>Show me entries:</b>
<BR>

When I submit this form I receiving a
"Documen contains no data"
message. But when I reload form page I see new entries.
dane.pl has 755
dane.html has 666

please help me,
JerzyO.
0
Comment
Question by:jerzyk
2 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 1831066
why don't you try putting some data in the document:
print "Content-type: text/html\n\n";
print qq(<html><head><title>document</title></head>\n <body>form submitted</body></html>\n);

0
 

Accepted Solution

by:
steve_howell earned 100 total points
ID: 1831067
Ozo's right: you're getting "document has no data," because you never wrote data to standard output in your CGI program.  A web server that supports CGI will display to the browser only what your program writes to standard output.  Your technique of writing a new HTML file every time doesn't really fit the CGI model, although you could have your CGI program write a new version of that file and immediately write it to standard output.

If, for some reason, you don't want the screen to change when you hit your page, you can send an HTTP header like this from your program:

Status: 204 No Content\n\n

When the browser sees this, it will know that your program is just doing something on the back end, and you don't want to redraw anything.


0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question