you cant use HTML in JavaScript alert you can make $des like this $des='hello\nhello'; or use this function function Blue_Preload($content) { // Strip newline characters. $content = str_replace(chr(10), " ", $content); $content = str_replace(chr(13), " ", $content); // Replace single quotes. $content = str_replace(chr(145), chr(39), $content); $content = str_replace(chr(146), chr(39), $content); // Return the result. return $content; } $str = Blue_Preload($str); but you msg will be "<p><srong>hello</strong></p><p><srong>hello</strong></p>" in alert On Mon, Jul 20, 2009 at 14:00, malayappa2000 <malayappa2000@xxxxxxxxx>wrote: > <? > $des='<p><srong>hello</strong></p> > <p><srong>hello</strong></p>'; > //$des1=trim($des); > > //echo $des1; > $str=str_replace (" ", "",$des); > ?> > <script> > alert('<?php echo $des1;?>'); > </script> > [Non-text portions of this message have been removed]