|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
<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... |
|
#3
|
|||
|
|||
|
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, |
|
#4
|
|||
|
|||
|
Just a little tip: use the qq() URL
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 URL |
|
#5
|
|||
|
|||
|
Just use it like this:
print qq(code); Its one great function for HTML... ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > HTML forms and Perl "print" statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|