text comin back in one line

Thread Solved

Join Date: Apr 2006
Posts: 357
Reputation: death_oclock will become famous soon enough death_oclock will become famous soon enough 
Solved Threads: 37
death_oclock's Avatar
death_oclock death_oclock is offline Offline
Posting Whiz

Re: text comin back in one line

 
1
  #21
Feb 11th, 2009
  1. <td width=""><p><?php echo wordwrap($message, 75, "<br />", true); ?></p></td>
Change 75 to whatever width you want.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 89
Reputation: serdas is an unknown quantity at this point 
Solved Threads: 0
serdas serdas is offline Offline
Junior Poster in Training

Re: text comin back in one line

 
0
  #22
Feb 11th, 2009
ok this worked but now the enter does not work if i write in one line it breaks it but when i am write and press enter it just puts a space and puts it in one line

is there anyway i can use it togetger with the other comand so it would see the enter


thank you
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: text comin back in one line

 
1
  #23
Feb 11th, 2009
  1. <td width=""><p><?php echo nl2br(wordwrap($message, 75, PHP_EOL, true)); ?></p></td>

The wordwrap function breaks your content down with PHP_EOL which is a constant that is defined to match the proper end of line charachter for your operating system.

Then uses nl2br to convert them to <br>'s including any ones the user entered.

the only thing i caution is against using the last parameter of "true" as this will allow php to cut words in half instead of breaking at the nearest word break
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 89
Reputation: serdas is an unknown quantity at this point 
Solved Threads: 0
serdas serdas is offline Offline
Junior Poster in Training

Re: text comin back in one line

 
0
  #24
Feb 11th, 2009
thank you very very much guys, it is solved it looks great,
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 148
Reputation: mschroeder is on a distinguished road 
Solved Threads: 25
mschroeder mschroeder is offline Offline
Junior Poster

Re: text comin back in one line

 
0
  #25
Feb 11th, 2009
Glad to be of assistance. Please mark the thread as solved if we've resolved your issue
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC