Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Problem with new lines

Guest
May 26, 2009 May 26, 2009

Copy link to clipboard

Copied

I have defined a form in Dreamweaver  to be used in conjuction with my SQL database (I am using the PHP/SQL).  One of the fileds in my form is of type TEXT (as opposed to VAR CHAR). Now, eventhough the text I am entering for that TEXT field has a number of paragraphs, when I read back the TEXT  field from the database (via sql SELECT),  the data for the TEXT field comes out continuously without paragraps. I don't understand why the paragraph or newline markings are not working when TEXT type data is retrieved from the database.  Can someone help me please.  Thanks!

TOPICS
Server side applications

Views

526
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 26, 2009 May 26, 2009

Copy link to clipboard

Copied

This is because HTML ignores new lines. The solution is to use the PHP function nl2br(). Depending on which version of Dreamweaver you're using, you can apply this function through the Bindings panel like this:

nl2br.png

This is certainly available in CS4, and maybe in CS3 too; but not earlier versions.

If you're using an earlier version of PHP, wrap the dynamic text in nl2br() like this:

<?php echo nl2br($row_recordsetName['fieldName']); ?>

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 26, 2009 May 26, 2009

Copy link to clipboard

Copied

LATEST

Thanks David,

I wrapped the nl2br() function around my echo statements and everything

works fine now! Fantastic!

I do have a question though: I am using CS4, but I am not able to find how

to access the nl2br function through the BINDINGS panel.

(That's why I modified directly the code and wrapped the function around my

echo statements).

Can you please tell me how you access the window that's in the picture you

sent me which contains the the conversion function (I tried a right-click on

the recordset fields but nothing shows).

Am I missing something???

Thanks again!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines