Jump to content

Removing Line Breaks In String Variable.


markhfla

Recommended Posts

I'm trying to send text from a mysql database to a flash file through a string variable. But, the string shows up in my code with line breaks from when it was entered into the database from a form. In order for the flash file to read the string, it must all be on one line in the code.

 

How can I remove these line breaks using PHP? I don't really want to remove them from the actual database text.

 

Here's what I'm getting:

description_text.swf?description=This is the way it's showing up with the
<br>
tag and on separate line. This doesn't work.

 

Here's what I want:

description_text.swf?description=This is the way I want it to show up with the<br>tag and all on one line. This does work!

Link to comment
https://forums.phpfreaks.com/topic/102824-removing-line-breaks-in-string-variable/
Share on other sites

WOW! That's the fastest response I've ever gotten. Thanks.

 

Unfortuantely, I've tried that and it doesn't work.

 

If this helps, here's some of the code:

$desc = str_replace("'","'",$myrow["full_description"]);
$desc = str_replace('"',""",$desc);
$desc=str_replace("<p>","<br><br>",$desc);
$desc=str_replace("\n","",$desc);

DarkWater,

 

A thousand blessings on your household! That worked. WHEW!

 

 

GuiltyGear,

 

I built the admin for this site years ago. So, my client just enters an open p tag. One of these days I'm going to have to get around to adding an html editor. Although, with the current problem I just had, maybe that's not such a good idea! :-P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.