Ugh, I've been working on this problem with my perl script for a while and I'm just totally stumped. I was recommended to you guys from over at the MacOSXHints.com forums, so I figured I might as well give it a try.

Anyway, what's happening is that the top part of my HTML output for a perl CGI script is getting cut off. You can see the problem here: http://ssrl.slac.stanford.edu/smbin/dataextractnews.pl . When you first load the script, it's fine. But then input "Fe" for the chemical element and press Apply for that form. When the next page finishes loading, you'll note that there's no picture, and a significant part of what was on the page the first time you loaded the script is now gone, even though it's supposed to be there.

I've narrowed down the problem to a few lines in my code:
#print hidden("xminval",$xTickLabels{'0'}),hidden("xmaxval",$xTickLabe +ls{'1'}); #print hidden("yminval",$yTickLabels{'0'}),hidden("ymaxval",$yTickLabe +ls{'1'});
These two commented out lines are causing the problem that you see that cuts off half of the output HTML (I'm using the CGI module). When not commented, they cause the problem, but when commented out, the page displays just fine (just without these four hidden fields, which are necessary for the script to work). I've separated them into four lines and I've found that the script works fine if one of the hidden fields is outputted, but as soon as I have another one outputted as well, the problem appears. It doesn't like more than one hidden field in that portion of the HTML for some reason. I've also tried replacing the CGI module calls with straight HTML text, and the problem doesn't disappear. I've even changed the fields to actual text fields instead of hidden fields, and the problem still occurs.

What's really mind boggling about all this is that I have text fields and hidden fields strewn all over other places on the page, but it just doesn't like these text fields. Is this a problem with my code, or is it likely an HTML problem? I've checked with other browsers to make sure that it's not just a bug in the web browser I'm using, but it occurs on all browsers.

Can anybody offer any insight as to where to check to fix this problem? I'm almost to the point of banging my head against the wall.

Thanks in advance for any help you guys can give.

In reply to Malformed HTML output by simX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.