Bluehost.com Web Hosting $6.95

blank lines problem

This is a discussion on blank lines problem within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hello, I have a strange problem using php and textarea input. When i have an textarea in a form like ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-25-2006
Bruintje Beer
 
Posts: n/a
Default blank lines problem

Hello,

I have a strange problem using php and textarea input. When i have an
textarea in a form like

line 1 etc etc
blank line
line 3 etc etc
line 4 etc etc
blank line
blank line
line 7

Later I put the textarea in a mysql table. Reading back and display in an
textarea. I see that the text is one line discarding the blank lines. How
can I preserve the blank lines when storing in database and reading back in
php.

thanks

Johan


Reply With Quote
  #2 (permalink)  
Old 03-25-2006
rlee0001
 
Posts: n/a
Default Re: blank lines problem

Line feeds should be automatically preserved. What are you doing to the
input prior to the INSERT call? What are you doing to output after the
SELECT call? What does the HTML source of the textarea look like when
it is read from the database?

-Robert

Reply With Quote
  #3 (permalink)  
Old 03-25-2006
Bruintje Beer
 
Posts: n/a
Default Re: blank lines problem


"rlee0001" <robeddielee@hotmail.com> schreef in bericht
news:1143282965.440587.39440@i40g2000cwc.googlegro ups.com...
> Line feeds should be automatically preserved. What are you doing to the
> input prior to the INSERT call? What are you doing to output after the
> SELECT call? What does the HTML source of the textarea look like when
> it is read from the database?
>
> -Robert
>


$query = "select * from tbl_profile where id = $id";'
$result = mysql_query($query);
$row = mysql_fetch_assoc($result)
$profile_oms = $row['profile_oms'];
<textarea name="profiel_oms" rows="10" class="textfield" id="profiel_oms">
<?php
print "$profile_oms";
?>
</textarea>

Johan


Reply With Quote
  #4 (permalink)  
Old 03-25-2006
rlee0001
 
Posts: n/a
Default Re: blank lines problem

Hmm,

There is nothing there to remove line feeds from the data. Are you sure
the data was stored with line feeds intact? When you view the resulting
HTML source is the content of the textarea all on one line or does it
just render that way?

If you really are getting a single line of text from that query, the
data was stored without line feeds and you should check to INSERT (or
UPDATE) procedures. It might also be possible that a CSS style is being
applied to the textarea so that it ignores line feeds and renders its
contents all on one line. Try sending $profile_oms to the contents of a
PRE tag as well.

Also, make sure you apply a htmlspecialchars to any output from a data
source that is sent to an HTML document.

-Robert

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 03:40 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0