mraiur Posted December 13, 2007 Share Posted December 13, 2007 Hi. I need to input a text in a textarea that looks like that when typed: " Sentence that is here. Sentence that is two lines under the first and and aligned more right. " And when i printed it it looks like that " Sentence that is here. Sentence that is two lines under the first and and aligned more right. " I am a learning now and i don't know moderate amount of php functions so please give me an sugestions. thx by mraiur. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 Can you be a little more clear please? You want to merge the text? Or you just like nice colors in your text areas? Other than that <?php $string = 'Sentence that is here. <br> Sentence that is two lines under the first and and aligned more right.'; $string = str_replace("<br>","",$string); ?> Quote Link to comment Share on other sites More sharing options...
mraiur Posted December 13, 2007 Author Share Posted December 13, 2007 No i mean that i type the text like the fist one but when i print it looks like i typed the sentences one after another .. only looks the same when i print it in a <textarea> Quote Link to comment Share on other sites More sharing options...
trq Posted December 13, 2007 Share Posted December 13, 2007 <?php echo "<pre>" . $_POST['textarea'] . "</pre>"; ?> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 No i mean that i type the text like the fist one but when i print it looks like i typed the sentences one after another .. only looks the same when i print it in a <textarea> use <?php echo nl2br($text); ?> it converts all news lines to <br> Quote Link to comment Share on other sites More sharing options...
mraiur Posted December 13, 2007 Author Share Posted December 13, 2007 i tried nl2br and it helped . Thx for the help and sorry for the "low info asked question" Quote Link to comment Share on other sites More sharing options...
phpSensei Posted December 13, 2007 Share Posted December 13, 2007 i tried nl2br and it helped . thanks for the help and sorry for the "low info asked question" Glad to help you, and don't worry, everyone makes mistakes. Quote Link to comment Share on other sites More sharing options...
helraizer Posted December 14, 2007 Share Posted December 14, 2007 <?php $string = 'Sentence that is here. \n\n \tSentence that is two lines under the first and and aligned more right.'; echo nl2br($string); ?> The \n\n will be turned to <br><br> thus giving you two lines lower, and no one has mentioned the indenting yet so the \t is equivelent to a press of the tab key, thus it indents it to the right slightly. Sam 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.