I am using the CGI module to write an html page. I'm using OO, so $q = new CGI; and $q->end_html prints the closing </body> and </html> tags fine. However, $q->start_html isn't printing the opening tags? Code below for the page and its associated 'view source'. Thanks.

sub sectionOne() { $q->header(); style (); $q->start_html(); print "Enter the Number of Buildings:\n"; print "<form name=\"form1\" action=\"add_building_names.cgi\" method=\ +"POST\">\n"; print "<table style=\"border-collapse:separate;padding:0px;width:100px +;font-size:8pt\">\n"; print "<tr>\n"; print "<td><input type=\"text\" name=\"num_buildings\" size=\"5\"></td +>\n"; print "<td><input type=\"submit\" name=\"submit_num_buildings\" value= +\"Update\"></td>\n"; print "</tr>\n"; print "<input type=\"hidden\" name=\"section_number\" value=\"2\">\n"; print "</form>\n"; print "</table>"; $q->end_html(); }


Here is the 'view source'

<style type="text/css"> table { border:solid black 0px; padding:10px; border-collapse:separate; width:600px; } td { border:solid black 1px; padding:5px; font-weight: bolder; text-align: center; } </style> Enter the Number of Buildings: <form name="form1" action="add_building_names.cgi" method="POST"> <table style="border-collapse:separate;padding:0px;width:100px;font-si +ze:8pt"> <tr> <td><input type="text" name="num_buildings" size="5"></td> <td><input type="submit" name="submit_num_buildings" value="Update"></ +td> </tr> <input type="hidden" name="section_number" value="2"> </form> </table> </body> </html>

In reply to CGI 'start_html' not printing opening <body> or <html> by spickles

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.