![]() |
|
|
nl2br() not working |
|
DEAD Good Coder
Posts: 1,095
Name: Stefan
Location: London, UK
|
Trying to replace new lines from what the user enters in a textarea into the html code '<br/>'
Of course nl2br() was created for this very reason. Somehow its not working though. PHP Code:
$form = $ecm2 $ecm2 is in a separate file which has been included on the top line of my whole php page. $content $content is part of $ecm2. PHP Warnings No warnings received from this script. preg_replace Is fully working
__________________
Offering Website Design Worldwide, please visit my website |
|
|
|
| Sponsored Links (We share ad revenue): |
|
|
Re: nl2br() not working |
|
Weightlifting CS Student
Posts: 453
Name: Nick Ohrn
|
If $ecm2 is just a string and $content is just a string then updating $content will not update the part of $ecm2 that is defined by $content. Once the string is created by concatenating $content into it, all references to $content are lost.
__________________
NickOhrn.com - My personal haven of insight to offer the world. Plugin-Developer.com - Custom plugin development to fit your needs. Plugins available for WordPress and Drupal, among others. |
|
|
|
|
|
Re: nl2br() not working |
|
DEAD Good Coder
Posts: 1,095
Name: Stefan
Location: London, UK
|
So how would I get it to update the $content part in $ecm2 ??
__________________
Offering Website Design Worldwide, please visit my website |
|
|
|
|
|
Re: nl2br() not working |
|
Ultra Talker
Latest Blog Post:
Web Development Business Tips Posts: 388
|
Try setting a value for $content before you include your file.
|
|
|
|
|
|
Re: nl2br() not working |
|
Eat, Sleep, Code
Latest Blog Post:
XDnet.co.uk The new name of Dansgalaxy Hosting. Posts: 5,361
Name: Dan
Location: Swindon
|
I think you just need to change this bit:
PHP Code:
to PHP Code:
hope this helps TP aprieciated ![]() DAN! ><
__________________
Support Children's Cancer and Leukaemia Movement shop online at buy.at/calm ~ Calmcharity.org PHP Code:
|
|
|
|
|
|
Re: nl2br() not working |
|
DEAD Good Coder
Posts: 1,095
Name: Stefan
Location: London, UK
|
Sorry for not replying sooner.
VirtuosiMedia, setting the value for the string above the include actaully worked. Thanks a lot Dan, Don't get greedy with TP ![]()
__________________
Offering Website Design Worldwide, please visit my website |
|
|
|
|
|
Re: nl2br() not working |
|
Ultra Talker
Latest Blog Post:
Web Development Business Tips Posts: 388
|
No problem, glad it worked out.
|
|
|
|
| Sponsored Links (We share ad revenue): |
| Thread Tools | |
|
|
| Webmaster Resources Marketplace: |
| Software Development Company | Webhosting.UK.com |
| Web Templates | Text Link Brokers | Stock Photos |