I have a script called a.cgi - which prints out a form which includes the normal submit and reset buttons at the end. The target for this form is b.cgi. To start with when the submit button was clicked b.cgi would take over and the form data was printed out ala html. But as a result of clicking the submit button i want to print out a text doc. THerefore i deleted print header(), start_html("some script"), and at the end end_html(), and replaced them with print header(-type=>'text/plain'). But now when I click on submit the browser begins to download b.cgi instead of recieving the text as I expected. But if i just enter http://baz.perlmonk.org/cgi-bin/b.cgi into the address window the script acts as i expected - outputing text in the browser window. THerefore the problem is only happening when the submit button calls b.cgi and when b.cgi prints in text context instead of html, another difference is that hitting submit posts to b.cgi. Whats going on, anyone?
Below is the piece of code used to call b.cgi( a.cgi and b.cgi are in the same directory)
print startform(-action=>'b.cgi',-target=>'_top'),table(Tr(\@table_con +t)),submit(-name=>'Submit'),reset(-name=>'Reset'),end_form;
...and everything worked perfect before i changed the header function etc, as outlined above.

In reply to Problem calling a script which outputs plain text by Baz

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.