Metin Alan, nl2br, çizgi bolca tatili

0 Cevap php

Ben kullanıcılar (birçok returns istedikleri gibi) ile metin girdiğinde, ve ben bir veritabanı içine yerleştirin ve sonra veritabanında biri ile TextArea değerini güncelleştirmek, bu değeri almak bir textarea var .

<textarea maxlength="500" cols="110" name="description" rows="15"><?php if(isset($newDesc)) echo snl2br_lose(nl2br($newDesc)); else echo nl2br_lose(nl2br($user->desc));?></textarea>

is my html. The issue i'm having is, whilst submitting the value and inserting it into the database works, it doubles the amount of linebreaks when it fills the value of the textarea. So if they type

Hey line break Foobar

Bu textarea değerini yapacak

Hey line break line break Foobar

function nl2br_lose($string) { 
     return str_replace('<br/>', '&#013;', str_replace('<br />', '&#013;',str_replace('<br>', '&#013;',str_replace('<br >', '&#013;',$string)))); 
 } 

Ben textarea "döner" haline nl2br açmak için istimal fonksiyonudur. Ben geri gelen nl2br_lose çıkarmak Ancak, sadece bir
vardır, böylece sorun olmalıdır. Ben bugün daha iyi parçası için bu sorun sahip oldum.

Şimdiden teşekkürler!

0 Cevap