in reply to textareas, form scripts, line breaks etc

Since you're using HTML tables, you should be aware that Netscape 4.x will not display anything within a table in the browser window if you don't close all the table tags. I don't see enough code here to see where you start or where you end your HTML tables. But that would by my first stab at what's going wrong. Also, if the user puts in HTML tags, this could break various things. You are doing sanity checks on your input, I hope! Since browsers are supposed to ignore more than one whitespace character in a row (including \r, \n, \t, and spaces), I doubt it's the \r's coming in from your textarea.

NOT a P.S. see use CGI or die; for why you should use CGI.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor

  • Comment on Re: textareas, form scripts, line breaks etc

Replies are listed 'Best First'.
Re: Re: textareas, form scripts, line breaks etc
by create 3 arrays. first array last names, second name first name and third array (Initiate) on Mar 02, 2001 at 21:38 UTC
    actually, i'm already doing that, --a bit more of my code:
    print "<HTML>\n<TITLE>$mb_title</TITLE>\n<BODY BACKGROUND=$bgpic BGCOL +OR=$bgcolor>\n"; print "<CENTER><FONT SIZE =+3>$mb_title<P></FONT></CENTER>\n"; print "<B>By the way, if you didn't notice, this is under construction +<BR></B>\n"; print "<TABLE BORDERCOLOR=$bordercolor BORDER=$bordersize>\n"; foreach( $msg_num = $msg_count -1; $msg_num >= 0; $msg_num--){ foreach( $i = 0; $i < @messages; $i++){ $sth = $dbh->prepare("select $messages[$i] from messages limit $ +msg_num, 1"); $sth->execute; $messageval[$i] = $sth->fetchrow_array; $sth->finish; }; $from = $messageval[0]; $date = $messageval[1]; $subject = $messageval[2]; $message = $messageval[3]; $msg_id = $messageval[4]; $message =~s/(\r\n|\n\r|\r)/<BR>\n/g; $message =~s/\n{3,}/\n\n/g; print "<TR><TD>\n"; print "Date: $date<BR>\nFrom: $from<BR>\nSubject: $subject<BR>\nMes +sage:<BR>\n$message<BR>\n"; print "<FORM METHOD='POST' ACTION='mb_post.pl'>\n"; print "<INPUT TYPE='HIDDEN' NAME='MSG_ID' VALUE='$msg_id'>\n"; print "<INPUT TYPE='HIDDEN' NAME='FROM' VALUE='$from'>\n"; print "<INPUT TYPE='HIDDEN' NAME='DATE' VALUE='$date'>\n"; print "<INPUT TYPE='HIDDEN' NAME='SUBJECT' VALUE='$subject'>\n"; $message = $messageval[3]; $message =~s/(\r\n|\n\r|\r)/\n/g; print "<INPUT TYPE='HIDDEN' NAME='MESSAGE' VALUE='$message'>\n"; print "<INPUT TYPE='SUBMIT' NAME='REPLY' VALUE='Reply'>\n</FORM>"; print "</TD></TR>\n"; }; print "</TABLE>\n"; print "</BODY>\n</HTML>\n";
    I dont really have sanity checks just yet, I was gonna throw those in later, this is my first project, so i'm kinda just picking it up as I go along I'm hoping to throw in the option of html formatting(maybe even buttons for generating it), but may wind up tossing that idea out. The resulting html code (for the messages that don't show the reply button) looks like this:
    <TR><TD> Date: 26 Feb 2001 23:50:30 -0000<BR> From: merlin@ethernaut.net<BR> Subject: this is a test with lynx<BR> Message:<BR> I'm testing lynx<BR> <BR> <BR> <BR> oh yeah....by the way....<BR> <BR> <BR> <BR> yamama<BR> <BR> <BR> <BR> <FORM METHOD='POST' ACTION='mb_post.pl'> <INPUT TYPE='HIDDEN' NAME='MSG_ID' VALUE='<20010302152810.22993.qmail@ +ethernaut.net>'> <INPUT TYPE='HIDDEN' NAME='FROM' VALUE='merlin@ethernaut.net'> <INPUT TYPE='HIDDEN' NAME='DATE' VALUE='26 Feb 2001 23:50:30 -0000'> <INPUT TYPE='HIDDEN' NAME='SUBJECT' VALUE='this is a test with lynx'> <INPUT TYPE='HIDDEN' NAME='MESSAGE' VALUE='I'm testing lynx oh yeah....by the way.... yamama '> <INPUT TYPE='SUBMIT' NAME='REPLY' VALUE='Reply'> </FORM></TD></TR>
      This is a html problem, not a perl problem. The HTML is there, it's just invalid.

      In particular, you need double-qoutes if your form values are allowed to include single-quotes:

      VALUE='I'm testing lynx..'
      needs to become:
      VALUE="I'm testing lynx"