First of all, have you done any CGI programming before? If not, then start out with a very very simple example or learn to use CGI if you don't feel comfortable with the not so esoteric art of CGI programming.

IMPORTANT! Before you run that CGI script of yours on the web first try to run it from your command line prompt like so:

C:\> perl -w mycgiscript.pl
If you get NO ERRORS and you get the output that you're expecting then you can try invoking your CGI script from a browser.

You should start out using something simple like this:

#!D:\Perl\bin\perl -wT use strict; print "Content-Type: text/html\n\n"; print "<html><body>\n"; print "Hello World!\n"; print "</body></html>\n";

And gradually add a SQL query or whatever and you'll obviously want to make sure that you output correct HTML which would include the DOCTYPE header.

Also, don't forget about SECURITY. Be careful in what you accept from the browser, if anything.

metadoktor

"The doktor is in."


In reply to Start Simple Before - Trying to output mysql query to browser by metadoktor
in thread Trying to output mysql query to browser by Johnny_bike

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.