Solved

Document contains no data

Posted on 1997-08-17
7
157 Views
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?

0
Comment
Question by:slat
7 Comments
 
LVL 2

Expert Comment

by:n3mtr
Comment Utility
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)

0
 

Author Comment

by:slat
Comment Utility
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

Thanks
                           
0
 
LVL 2

Expert Comment

by:n3mtr
Comment Utility
have you run: perl -cw script
to check the warnings for a possible problem?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 5

Expert Comment

by:icd
Comment Utility
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.

0
 

Expert Comment

by:edl
Comment Utility
All of the above advice is good.  When doing cgi, always do perl -c prog.pl.

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.

0
 
LVL 8

Accepted Solution

by:
jhurst earned 100 total points
Comment Utility
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.
0
 

Author Comment

by:slat
Comment Utility
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.

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now