I have a multiline text field in a form thats information is sent to my db. When a user views a page that outputs the db with echo "$multiline"; the line breaks the user originally put in are not there.
Is this because the db only keeps the text not formatting or because the echo command doesnt preserve the formatting?
More importantly, how do I display the info the user typed, how he typed it?
Thank you,
Ace
Keep formatting
Moderator: General Moderators
If I input:
So you usually see: "BlaBla blabla" when u echo $bob. In the database, it is multiline....but yeah..it doesn't preserve it...
TO DO THIS: suppose you extract the contents of what you want from ur database and u put it into a variable called '$bob'
then when you echo $multilinebob, you get a multiline version....you could ASLO do this with spaces if you want...make it replace ' ' with ' '
hope i helped....
later on, -Brian
into a textbox named 'bob'.Bla
Bla bla
bla
So you usually see: "BlaBla blabla" when u echo $bob. In the database, it is multiline....but yeah..it doesn't preserve it...
TO DO THIS: suppose you extract the contents of what you want from ur database and u put it into a variable called '$bob'
Code: Select all
$search = array("/\n/");
$replace = array("<br />\n");
$multilinebob = preg_replace($search, $replace, $bob);hope i helped....
later on, -Brian