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. Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/ 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); ?> Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414364 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> Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414371 Share on other sites More sharing options...
trq Posted December 13, 2007 Share Posted December 13, 2007 <?php echo "<pre>" . $_POST['textarea'] . "</pre>"; ?> Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414373 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> Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414374 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" Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414383 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. Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414386 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 Link to comment https://forums.phpfreaks.com/topic/81592-solved-input-output-problem/#findComment-414403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.