Resend my activation email : Register : Log in 
BCF: Bike Chat Forums


How can you display messages in PHP spanning many lines

Reply to topic
Bike Chat Forums Index -> The Geek Zone
View previous topic : View next topic  
Author Message

simon1221
World Chat Champion



Joined: 28 Jul 2004
Karma :

PostPosted: 12:25 - 15 Feb 2006    Post subject: How can you display messages in PHP spanning many lines Reply with quote

Basically the equivalent of this forum, the messages is stored in the MySQL database correctly, with new lines and all.

I was using the 'echo' function but that doesnt work properly.

The best I have at the moment is storing it in read-only text boxes, which is rather crude:

<textarea name="textarea" cols="65" rows="10" readonly="readonly" wrap="off"><?=$msg;?>
</textarea>

Is there a better way of doing this?

Many thanks
____________________
DNA50 (sorry) ->> TZR125l >> GPZ500S
 Back to top
View user's profile Send private message You must be logged in to rate posts

Suzuki
Roger



Joined: 03 May 2005
Karma :

PostPosted: 12:30 - 15 Feb 2006    Post subject: Reply with quote

The text is stored with the new lines marked with the return character "\n".

If you want this to display correctly on a webpage, you need to replace all the return characters with "<br>".

Thumbs Up
____________________
<Simple> no I'm shaven Jon Razz
<Simple> it is a big enough hole.. I'll leave it now
Ride: 1999 Suzuki GSXR600 (yellow/black) IRC: Stats - Relationship Map
 Back to top
View user's profile Send private message Send e-mail Visit poster's website You must be logged in to rate posts

Dom
World Chat Champion



Joined: 06 Sep 2004
Karma :

PostPosted: 14:05 - 15 Feb 2006    Post subject: Reply with quote

$textfromdatabase = nl2br($textfromdatabase);

Bob's your thingamywhatsit.
____________________
Photos and that
 Back to top
View user's profile Send private message Send e-mail Visit poster's website You must be logged in to rate posts
Old Thread Alert!

The last post was made 18 years, 74 days ago. Instead of replying here, would creating a new thread be more useful?
  Display posts from previous:   
This page may contain affiliate links, which means we may earn a small commission if a visitor clicks through and makes a purchase. By clicking on an affiliate link, you accept that third-party cookies will be set.

Post new topic   Reply to topic    Bike Chat Forums Index -> The Geek Zone All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Read the Terms of Use! - Powered by phpBB © phpBB Group
 

Debug Mode: ON - Server: birks (www) - Page Generation Time: 0.06 Sec - Server Load: 1 - MySQL Queries: 17 - Page Size: 37.54 Kb