PHP and SQL Server carriage returns

Posted on 2007-08-02
Last Modified: 2013-12-12
I have a text area that accepts user input and submits it to a SQL Server database. Later on, that information is pulled out of the database and printed on the web browser. My problem is that in this process the carriage returns are disappearing. The text that appears in the browser is all compacted. What can I do to fix this problem?
Question by:alateos
    LVL 8

    Accepted Solution

    Are you sure the returns are disappearing? Try to use nl2br() to change the new lines to <br>'s. HTML can't show carriage returns...

    Author Comment

    What is nl2br()
    LVL 8

    Expert Comment

    It means "new line to break". Read this:

    You need to convert the carriage returns to HTML-breaks...

    Author Comment

    it works perfectly thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Problem to be resolved in this article Currently, development of website and web application can be done without writing thousands of lines of programming code by hand. Description This can be done through by using a open source framework such …
    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now