shebbycs Posted April 10, 2013 Share Posted April 10, 2013 (edited) In operation or action & results using textarea For example if person insert or input data and when the data reached finish line it will automatically line break and save to database My problem was when calling from database, the data will output long text instead of user input which has linebreak Any solution please where the user input data via textarea it will automatically recognized line break Edited April 10, 2013 by shebbycs Quote Link to comment Share on other sites More sharing options...
requinix Posted April 10, 2013 Share Posted April 10, 2013 Use nl2br, which will convert the regular \r and \n line breaks into the s HTML actually cares about. Quote Link to comment Share on other sites More sharing options...
shebbycs Posted April 10, 2013 Author Share Posted April 10, 2013 Use nl2br, which will convert the regular \r and \n line breaks into the <br>s HTML actually cares about. But I created sample program //linebreaks.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="linebreaks2.php" method="post"> <textarea name="ye" cols="40" rows="10" ></textarea> <input type="submit" name="submit" value="press"> </form> </body> </html> //linebreaks2.php <?php if(isset($_POST['submit'])) { $a = nl2br($_POST['ye']); echo $a; } ?> linebreaks.php and linebreaks2.php screenshot after i input The word was not in line break Quote Link to comment Share on other sites More sharing options...
requinix Posted April 10, 2013 Share Posted April 10, 2013 There aren't any line breaks in there. Are you talking about word wrapping now? Quote Link to comment Share on other sites More sharing options...
shebbycs Posted April 10, 2013 Author Share Posted April 10, 2013 There aren't any line breaks in there. Are you talking about word wrapping now? Sorry my english will be bad but I try first Based on this picture, look on the first line of s when come to the second line of s, I never put the "Enter" keystroke and that leads to the second photo where all s in one line can textarea be coded when its reached limit of column it can line break for second line without pressing "Enter" keystroke? Quote Link to comment Share on other sites More sharing options...
requinix Posted April 10, 2013 Share Posted April 10, 2013 That's word wrap. Quote Link to comment Share on other sites More sharing options...
shebbycs Posted April 11, 2013 Author Share Posted April 11, 2013 That's word wrap. how to do that ? but if I know if wordwrap its set the limit how many character in one line right? Quote Link to comment Share on other sites More sharing options...
requinix Posted April 11, 2013 Share Posted April 11, 2013 Have you looked at the link I gave? Quote Link to comment Share on other sites More sharing options...
shebbycs Posted April 11, 2013 Author Share Posted April 11, 2013 Have you looked at the link I gave? yeah I saw but all was text where mine is text in textarea ok i post another picture If you see in field let said now I want to input one data which is line number 13 that show Time = 10.00 am Task = Morning Briefing Operation = 1) Sales Performance Review Staff A = RM 5,000.00 Staff B = RM 3700.00 Staff C = RM 4,200.00 2) Staff Performance Review a) Service Performance Review b) Attendance Performance Review and all this data is inserted in one line where the operation input data I label as text area My data can be shown same like this picture above using that nl2br function but only if the person who input data in text area using "Enter" keystroke to move new line but as we know when we write in textarea after it reached lts limit column it will automatically move to the next line but still if using nl2br function, the data were not in linebreak same according to the first one i mention About word wrap how it will be balance the word if first line for example was 25 but second form the first line was 30 Quote Link to comment Share on other sites More sharing options...
requinix Posted April 12, 2013 Share Posted April 12, 2013 About word wrap how it will be balance the word if first line for example was 25 but second form the first line was 30Not sure what you're saying but try the function out. Don't forget the third parameter which is what it should use as the wrapping string. 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.