Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string manipulation

Status
Not open for further replies.

dzisaacs

Programmer
Dec 12, 2002
53
PA
// i read this variable from the DB
$message = $db_Message

// i pass it to a function
echo "function($message)";

------

in the HTML it gets displayed like this

function('<H1>Hello</H1>
<P><FONT color=#ff0000>World</FONT></P>')

obviously this doesn't work for me because i need it to be like this


function('<H1>Hello</H1><P><FONT color=#ff0000>World</FONT></P>')

i need to do some manipulation in $message = $db_Message to have the string in this way <H1>Hello</H1><P><FONT color=#ff0000>World</FONT></P>
not this way
<H1>Hello</H1>
<P><FONT color=#ff0000>World</FONT></P>

any ideas?
 
"function($message)" is just a string. function($message) is a reference to a function. PHP interpolates variables inside quotes, not function refrences.

Try:

echo function($message);



Want the best answers? Ask the best questions! TANSTAAFL!
 
You want to add a carriage return between </H1> and <P> correct?

Not to sound obtuse, but the browser wont mind if its </H1><P>
or </H1>
<P>

It's still going to render it the same, if you want the browser to add a line break after the header and before the paragraph. then add a <br> in between.

What is it you are trying to do?


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
$message = str_replace("\r\n","",$msg_Message);

this is what fixed my problem....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top