this code:
$blogid = mysql_real_escape_string($_get['id']); if((isset($_post['comment']))&&(!(trim($_post['comment'])==false))&&(isset($_session['userid']))){ $comment = mysql_real_escape_string($_post['comment']); $querycomment = "insert `comment` (`userid`, `blogid`, `body`) values ( '".$_session['userid']."', '".$blogid."', '".$comment."');"; $rowchat = mysql_query($querymess,$db_con) or die("failed: " . mysql_error() ); } <form method="post" action="blog.php?id=<?php echo $blogid; ?>" > <textarea name="comment" ></textarea> <input type="submit" value="send" name="submit" /> </form> when user comment this:
this world then in comments list appears this:
this world why doesn't line break works ?
because line breaks saved \n.
you can use php function nl2br($string) before echo'ing string.
<?php $string = "this\nis\nmy\nworld"; echo nl2br($string); ?>
Comments
Post a Comment