Document contains no data

Posted on 1997-08-17
Last Modified: 2013-12-25
I have a form which updates a number of files. when the form is empty and I press submit everthing works fine.
Howver if I try to submit the form with data I get a netscape error document contains no data.

What is going wrong?

Question by:slat

Expert Comment

ID: 1829718
Netscape is trying to tell you that the CGI program is returning a blank document.  Nothing in it.  It seems when the script gets data it forgets to return a response.
Without more information, thats all I can say.
Whay script are you using? Did you write it yourself?  Can you post it here?(if its short)


Author Comment

ID: 1829719
The cgi script is a bit complicated.
The relevant part does the following things.
1) the form contains a hiden field action=Modify, when the data is parsed using cgi-lib all the data in %in si passed to a subroutine for processing.

2) there 3 files are opened , then the data is processed then the data is written to the each of the files, an d the files clesed;
Here is the relevant code:

foreach $cle(@Env_Var::Total_options) {

           $array_nom = "Env_Var::" . $cle . "_ops";
           $vide_hash = "Env_Var::" . $cle . "_vide"; # whether a field can be empty or not
           $Sur_Prog = $BIN_DIR . $cle . ".pl"; # put in option for http progs
here ie . "H" . $cle ....
             # use strict 'refs';
         HERE: {

            for ($y=1; $y <= $Env_Var::Nombres{$cle}; $y++) {

                # local($op,$nom,$min,$jr,$mois,$hr, $alerte, $warn, $fich);
                if ($Env_Var::Nombres{$cle} > 1) { $op = "$cle" . "$y"} else { $op = $cle;}
                $nom = $op . "_nom"; #every thing being nom  must have a nom
                 next HERE if (($CHECKED_data{$nom} eq "") || ($CHECKED_data{$nom} eq "non"));
                $Cron_String = $Sur_Prog . " " . $nom_machine . " " . $Env_Var::KNOWN_HOSTS{$nom_machine}; # <-prog host os; reset every loop
                foreach $el (@{$array_nom}) {

                   # each field in the form becomes $cle . $y . $el, ie $op = $cle . $y .$el, and the data is written to the files, eg print FILE $data, "=", $data{$op}, "\n"; however the program never makes it passed the above for loop; I have put a subroutine which prints out a html page just before the loop followed by a next statement so the the loop is not processed, which worked; however, when I allow this loop to be processed I get the error ¨document contains no data¨ - note: there is no error in the error_log file ; also I have even tried replacing the symbolic array reference with a simple array, but I still got the same error;
         } #HERE
       }# total ops
# files close;
# subroutine to display a html page

} end of subroutine

- I realise this isn't very clear, but the full code is very long and complicated. However, I would be extremely grateful if you if
you have any inkling as to why it never gets passed the third for loop


Expert Comment

ID: 1829720
have you run: perl -cw script
to check the warnings for a possible problem?
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.


Expert Comment

ID: 1829721
You should also look at the error log on your server. It is likely you have a run-time error with your script which is causing it to fail. The error log is likely to tell you roughly which line of the script is failing.


Expert Comment

ID: 1829722
All of the above advice is good.  When doing cgi, always do perl -c

And when a program like this is giving you problems you are probably going to have to go in debug mode.  Put a simple print statement in the beginning of your program then exit(1);

If that get's printed to the web browser, then you just have to start debugging your code.


Accepted Solution

jhurst earned 100 total points
ID: 1829723
the message is caused by the fact that the script is presenting no data at all.  My guess is that when there is data in the form the script fails and so does not generate, or at least does not complete the output.

You need to run the same script directly at the shell and pass it the input required.  If your are using GET then you can merely set the QUERY_STRING environment variable with the data that you believe is being passed to the form.  If POST then you just input it.  In this mode you should see the output and/or error.  I would also consider re-directing the stderr so you can see if there is a reported error.

Author Comment

ID: 1829724
thank you everyone for your assistance.

Yes the reason was that the cgi script was sending no data
back. There was an error in a subroutine, used to process the data.


Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
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 the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

763 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