Ads Posted May 17, 2010 Share Posted May 17, 2010 Hey, I am trying to create a Personal Message system for my website. Creating it is no issue, But I am trying to add the feature so when you view the Message and go to reply to adds a "----------Original Message---------" To indicate the different Messages between teh two users. This is the code I am using to add the break to the $msg which is then submitted to the Database $msg=$_POST['msg']; $msg="<br><br>---Original Message---<br>".$msg; And this is the code I am using to Convert the string from the Database and it being displayed into a <textarea> $select_mail = mysql_query("select * from mailbox where id='$id'"); $b = mysql_fetch_array($select_mail); $h = $b['msg']; $h = str_replace("<br>", "\n", $h); It Displays It within HTML Fine, But it Displays Nothing when I try and put it into the <Textarea> for the user to reply with. Any Help would be Great, Sorry if it is a Bit Confusing =( Quote Link to comment Share on other sites More sharing options...
merylvingien Posted May 17, 2010 Share Posted May 17, 2010 If you want the original message to appear withing the text box that you write the reply, try this: <textarea name=\"?\" rows=? cols=?>$msg</textarea> Obviously fill in the question marks. However, it would probably be better to show the original message above the reply text box, maybe just put a border around it and different background colour to highlight it. Quote Link to comment Share on other sites More sharing options...
Ads Posted May 17, 2010 Author Share Posted May 17, 2010 If you want the original message to appear withing the text box that you write the reply, try this: <textarea name=\"?\" rows=? cols=?>$msg</textarea> Obviously fill in the question marks. However, it would probably be better to show the original message above the reply text box, maybe just put a border around it and different background colour to highlight it. Okay, That does display the text within the box, But I want it to have Line Breaks, which only display as /n but i want them to be an acctual newline. Quote Link to comment Share on other sites More sharing options...
scampbell Posted May 17, 2010 Share Posted May 17, 2010 You would probably be better off using nl2br to display the PMs, rather than manually adding in <br> markup. That way line breaks will be preserved. Quote Link to comment Share on other sites More sharing options...
merylvingien Posted May 17, 2010 Share Posted May 17, 2010 Yes, as scampbell has indicated. $msg = nl2br($msg); Quote Link to comment Share on other sites More sharing options...
Ads Posted May 18, 2010 Author Share Posted May 18, 2010 Okay, Thanks. I Managed to get it working =D...for now Thanks Heaps Guys 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.