Jump to content

How do I prevent nl2br from breaking a long link?


pneudralics

Recommended Posts

//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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.