0 Replies Latest reply on May 26, 2009 4:34 PM by David_Powers

    Paragraphs don't display in database results (PHP)

    David_Powers Level 7

      Unless you insert text into a database formatted with HTML tags, any line breaks will be ignored, resulting in a solid block of text when displayed in a browser. This is because browsers ignore whitespace and new lines in the underlying text.


      The way to resolve this problem in a PHP page is to use the nl2br() function, which converts new lines into HTML <br /> tags. In Dreamweaver CS4, you can add this function to dynamic text through the Bindings panel as shown in the following screenshot:


      You can also add it to individual dynamic text objects by double-clicking the dynamic text listed in the Server Behaviors panel, and selecting Convert - New Lines to BRs in the Format field, as shown here:


      In older versions of Dreamweaver, you need to wrap the dynamic text in nl2br() manually in Code view like this:

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