i have a textarea value which its value derived from a field(nl2br)
how to strip off "< br/>", so that when i want to edit this field, the "< br />" will not be appeared?
//$data["Content"] is the field that has <br/> tags inside
$content = $data["Content"];
//when want to edit, want to strip the <br/> tag
<td><textarea name="content" rows="10" style="width:300px;"><?=$conten开发者_C百科t?></textarea></td>
i know it should be using strip_tags() function but not sure the real way to do it
any help would be appreciated
If you wanna use strip_tags, then it would just be:
$content = strip_tags($data["Content"]);
i would be using str_replace the following will replace <br/>
with newline
$content = str_replace('<br/>','\n',$data['Content']);
or if you don't want the newline
$content = str_replace('<br/>','',$data['Content']);
edit an example
$my_br = 'hello<br/> world';
$content = str_replace('<br/>','',$my_br);
echo $content;
Output: hello world
精彩评论