When we make a post to our site it looks fine but when we view the post we see a bunch of \r\n.

We are told that we should use something like

str_replace("\r\n","<br/>",$YOUR_VAR)

in order to stop this.

Here is my question is the above correct? If so how would we right it out and where would we put it.

We are uncertain if we can just add it to our header file or if it needs to be in a specific file such as the file that outputs the text and so on.

If you guys can give some details and such it would be greatly appreciated.

Thank you.

A nicer alternative might be to use the nl2br php function.

R.

If that would be more appropriate that would be great but how would I go about using it on our site?

To further clarify we dont want to replace the \r\n with something else we simple do not want it to display anything.

Member Avatar for rajarajan2017

Then try this

str_replace("\r\n"," ",$YOUR_VAR)

Where would we put it? In the header or where?

Thanks for the help.

Ok we got this figured out thanks for all the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.