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!
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:
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']); ?>
Copy link to clipboard
Copied
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!