CSmith1128 Posted May 14, 2007 Share Posted May 14, 2007 ok.. heres what I have... i am making a message system where the users can send eachother messages. I have a reply feature so they can reply to messages received. The problem I am having deals with line breaks. - I store each message in a text file. - When the user clicks reply, it takes the text from the text file and store it into a text area form box. - To insert the line breaks I use \n. It shows up fine in the text area. - Now when I send it to the script, I use $_REQUEST['message']; to retreive it. - To debug it, I have the text displayed on the page so I know what it looks like before it is stored. - However, it does not show the line breaks. - I have tried changing the line breaks to html using <br>, however, when it is displayed in the text area, it shows <br> instead of the actual line break. So if i want to display the previous message, it shows <br> instead of the line. - Does anyone know away around this so I can show the line breaks in both the text area and text file without having the user see <br>? - Also, when the user inserts a new line in the text area when the are typing a new message it does not show up as a new line.. is there a fix for this too? Thanks Chris Quote Link to comment https://forums.phpfreaks.com/topic/51246-solved-need-some-help-with-line-breaks/ Share on other sites More sharing options...
AndyB Posted May 14, 2007 Share Posted May 14, 2007 nl2br() on the output from the text file Quote Link to comment https://forums.phpfreaks.com/topic/51246-solved-need-some-help-with-line-breaks/#findComment-252443 Share on other sites More sharing options...
CSmith1128 Posted May 14, 2007 Author Share Posted May 14, 2007 yeaa that works, however, in the text area it shows "br \".. I just want it to show lines in the text area instead of the actual html... this is what I am trying to put into the text area... $doubleLine = "-----------------------------------\n-----------------------------------"; $line = "-----------------------------------"; $newMessageValue = "\n\n\n\n\n" . $doubleLine . "\nMessage From: " . $firstname . " " . $lastname . "\n" . $tmonth . " " . $tday . ", " . $tyear . " at " . $thour . "\n" . $line . "\n" . nl2br($oldMessage); with that, everything works fine and when it sends it to the script, it shows up how I want it.. so I can change the lines to the following, but then it shows up with the br \ in the text area, which i am trying to avoid if possible.. $doubleLine = "-----------------------------------br /-----------------------------------"; $line = "-----------------------------------"; $newMessageValue = " br / br / br / br / br /" . $doubleLine . "br /Message From: " . $firstname . " " . $lastname . "br /" . $tmonth . " " . $tday . ", " . $tyear . " at " . $thour . "br /" . $line . "br /" . nl2br($oldMessage); is there away around that? if not i can live with it showing the br / in the text area.. Note: in the code above it needs the < and > around br \ , i just left it out because it doesnt show up when the topic is submitted, and i dont know a way around it. Quote Link to comment https://forums.phpfreaks.com/topic/51246-solved-need-some-help-with-line-breaks/#findComment-252445 Share on other sites More sharing options...
CSmith1128 Posted May 14, 2007 Author Share Posted May 14, 2007 nevermind.. i got it to work.. thanks! Quote Link to comment https://forums.phpfreaks.com/topic/51246-solved-need-some-help-with-line-breaks/#findComment-252448 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.