Document contains no data

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?

Who is Participating?
jhurstConnect With a Mentor Commented:
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.
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)

slatAuthor Commented:
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

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

have you run: perl -cw script
to check the warnings for a possible problem?
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.

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.

slatAuthor Commented:
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.