pneudralics Posted June 10, 2009 Share Posted June 10, 2009 //Breaks lines in my textarea $post = nl2br($_POST['description]); The issue is when I submit something like: <a href = "veryveryverylonglonglonglonglink">longlink goes here</a> and the link starts a new line in the textarea like <a href = "veryveryverylonglonglonglonglink">longlink goes here</a> nl2br automatically adds a br after the break like this <a href = <br /> "veryveryverylonglonglonglonglink">longlink goes here</a> The <br /> is not saved in the database but when I display it with: $description = stripslashes(html_entity_decode($memberrow ['description'])); $description2= wordwrap($description, 80, "<br />", true); How would I prevent it from breaking something like that other than changing the 80 to something higher? Link to comment https://forums.phpfreaks.com/topic/161630-how-do-i-prevent-nl2br-from-breaking-a-long-link/ Share on other sites More sharing options...
thebadbad Posted June 10, 2009 Share Posted June 10, 2009 It wouldn't be a problem with nl2br() I believe, as a newline only is inserted when [Enter] is hit. If you remove the fourth parameter in wordwrap(), long words aren't cut. Link to comment https://forums.phpfreaks.com/topic/161630-how-do-i-prevent-nl2br-from-breaking-a-long-link/#findComment-852887 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.