[Tutor] reading forms
Kent Johnson
kent_johnson at skillsoft.com
Thu Aug 5 02:10:32 CEST 2004
At 05:14 PM 8/4/2004 -0600, Priyanka wrote:
>Hi,
>I have created a html form that posts the comments posed by a visitor to
>my website. It has a text area for letting the visitor write the comment
>in. However when I use cgi.FieldStorage() to get the string in the text
>area, it is not printing out the '\n' character of the string. Thus,
>even when I use the string.replace() function to replace the '\n'
>characters with <br:>, it is not doing so.
You should use <br> or <br /> not <br:>
>Also, is there any method by which the browser would not interpret the
>HTML tags in the comment area and print them out as is?
Do you mean you want to show the comment in an HTML page? Try
cgi.escape(comment), this will turn '&<>' into '&<>'
Kent
More information about the Tutor
mailing list