dzisaacs Posted December 14, 2006 Share Posted December 14, 2006 when i echo a string i get the following result<H1>Hello</H1><P><FONT color=#ff0000>World</FONT></P>I need to convert it to<H1>Hello</H1><P><FONT color=#ff0000>World</FONT></P>Can someone help me in doing this? Quote Link to comment Share on other sites More sharing options...
chiprivers Posted December 14, 2006 Share Posted December 14, 2006 Do you mean it is adding a line break? The <p> tag always does that, do you need you use a <p> tag? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted December 14, 2006 Share Posted December 14, 2006 I think you are referring to how this displays on the screen; i.e. you get Hello and then world on the next line. This is indeed a html issue - h1 and p tags are block level so they will clear to the next avilable line within the current element.If that is the html you are outputting then you will have to change the display properties of h1 and p in your style sheet to:h1 , p { display: inline;}That will put it on one line BUT you will not have a space between words... Quote Link to comment Share on other sites More sharing options...
dzisaacs Posted December 15, 2006 Author Share Posted December 15, 2006 // i read this variable from the DB$message = $db_Message// i pass it to a functionecho "function($message)";------in the HTML it gets displayed like thisfunction('<H1>Hello</H1><P><FONT color=#ff0000>World</FONT></P>')obviously this doesn't work for me because i need it to be like thisfunction('<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? Quote Link to comment Share on other sites More sharing options...
Albright Posted December 15, 2006 Share Posted December 15, 2006 [code]<?php$message=str_replace("\n","",$message);?>[/code]That should strip out all the newline characters. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.