Jump to content

translate carriage returns in textarea


dadamssg87

Recommended Posts

i have this in a form

 

<textarea id='textarea' name='tweet' maxlength=140 >
<?php
if(isset($_SESSION['description']))
{ echo $_SESSION['description'];}
?>
</textarea>

 

the session variable is just their input and i use that to repopulate the form if the validation script catches an error with their input.

 

The problem is when the user enters carriage returns and then if theirs an error....

 

this...

"blah blah

 

blah"

 

turns into this...

"blah blah\r\n\r\nblah"

 

how do i remove that junk?

Link to comment
https://forums.phpfreaks.com/topic/232942-translate-carriage-returns-in-textarea/
Share on other sites

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.