List:General Discussion« Previous MessageNext Message »
From:Christopher R. Jones Date:January 23 2001 2:34am
Subject:RE: Form Submission
View as plain text  
Actually, the TEXTAREA tag does capture the line breaks, they get stored in the mysql
table in a text type column.  When I query the table and re-display the TEXTAREA, the
line breaks are preserved.  I am using Perl CGI scripts with DBI, DBD-MySQL.

I defined the TEXTAREA (in perl):
<TEXTAREA NAME="portfolio-portdesc" ROWS="5" COLS="65" WRAP="SOFT" > $portdesc
</TEXTAREA>

The $portdesc is assigned the value directly from the SELECT statement, no fancy
formatting required.

>Mike,
>         I'm assuming that you are trying to output this to a webpage.
>
>         I think your problem is that, HTML does not use line breaks in the
>document. You can try this out by making a simple webpage like this:
>
><p> A
>B
>C
>D
></p>
>
>         When you view this in your internet browser, you will see:
>
>A B C D
>
>         To insert a line break in HTML, you use a "<br>" tag. In order to have
> the
>line breaks appear properly in your final document you must insert a "<br>"
>every place the line breaks should appear, and a "</p><p>" at every
>paragraph break.
>
>         In PHP I I have my own funtion to do this, but it would not be that hard to
>make one for Perl or ASP, if that is what you are using. It's just a simple
>search and replace.
>
>function format_text($text){
>         // Change any "<", and ">" their equivalent HTML entities
>         $text = htmlspecialchars($text);
>         // Strip out carriage returns
>         $text = ereg_replace("\r","",$text);
>         // Handle paragraphs
>         $text = ereg_replace("\n\n","</p><p>",$text);
>         // Handle line breaks
>         $text = ereg_replace("\n","<br>",$text);
>return $text;
>}
>
>
>Hope this helps,
>
>Daniel Von Fange
>
>-----Original Message-----
>From: mike@stripped
>[mailto:mike@stripped]
>Sent: Monday, January 22, 2001 8:37 PM
>To: mysql@stripped
>Subject: Form Submission
>
>
>When I submit a form and enter it into the database
>it does not recognize when the user presses enter.
>It keeps coming up as one long line, and for poetry,
>it doesn't look very pleasant.
>
>I would love if anyone could help me because it would
>very much help me when creating future projects. I am
>only 16 and I am doing considerably well since the
>person that showed me MySQL said it was too hard for
>me and I will never get anything good done.
>
>But anyways, please help
>
>Mike
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread62696@stripped>
>To unsubscribe, e-mail
><mysql-unsubscribe-brains=daniel-labs.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread62698@stripped>
>To unsubscribe, e-mail <mysql-unsubscribe-cj=interlog.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Thread
Form Submissionmike23 Jan
  • Re: Form SubmissionPaul DuBois23 Jan
  • RE: Form SubmissionDaniel Von Fange23 Jan
    • RE: Form SubmissionChristopher R. Jones23 Jan