#1
  1. No Profile Picture
    tbonds
    Guest
    Devshed Newbie (0 - 499 posts)
    Is there a good web reference on how to use HTML properly when printing the various form tags as output? For example, print "<b>Hello World.</b>n"; is no problem. However, using print "<FORM blah, blah, blah></FORM>n"; is a problem. Do form elements need to be coded syntactically different than their simpler hmtl bretheren? My Perl references don't seem to cover this.

    Thanks,
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    15
    <form> tags are coded the same way all other tags are coded. You place the <form> element around other elements which are then called the form "controls". Those controls are what you use to write a message at this forum. So to code a simple <form> tag in Perl you could use something like this:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    print "<form name="form1" action="script.pl" method="post">n";
    [/code]

    Or you can always use the CGI.pm module and its HTML shortcuts...
  4. #3
  5. No Profile Picture
    tbonds
    Guest
    Devshed Newbie (0 - 499 posts)
    Ahhh, I don't think I was escaping my quotes in the form code when I tried to print them! Perl generated some type of "illegal divide by zero on line x" message when I tried to run my script at the command line. Don't know what that meant, but maybe the lack of escapes had something to do with it. Anyway, thanks for your example. I'll give it a try.

    Regards,

  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    2
    Rep Power
    0
    Just a little tip: use the qq()

    It's not a very known code, but quite handy. It ignores all quotes within it.
    You could do something like:

    print "qq(<form name="name" action="get.cgi" method="post"> )");

    That would work.... I'm actually not sure how to use that code, since I use it so rarely.... but experiment a bit with the qq() function and you'll figure out how to use it
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    300
    Rep Power
    15
    Just use it like this:
    print qq(code);

    Its one great function for HTML...

IMN logo majestic logo threadwatch logo seochat tools logo