ADHI
ADHI

Reputation: 131

How to remove line break<br> from and mysql output using PHP

I used

 <br> 

in textarea to write some articles in backend, the output came exactly what i expected on webpage.I used 3rd party apps to share the article description to mobiles and in social netowrking. While sharing the article description the br> tags are seen in the 3rd party apps.

How to remove the
tags from the article description ?

<?php echo ($rows['description']); ?>

I used the below method which removes the
tag but it also removes the line breaks in the artile. How to remove the
tag and not line break in textarea

<?php
$value=$rows['description'];
$sendarticle= preg_replace('/[\<br>]/', '', $value);
?>

Upvotes: 0

Views: 1069

Answers (2)

Clint Bugs
Clint Bugs

Reputation: 13811

<?php echo htmlentities($rows['description']); ?>

try this

Upvotes: 0

Zulakis
Zulakis

Reputation: 8374

Use PHP's

strip_tags($str)

function to replace all NULL-Bytes, PHP-Tags and HTML-tags from $str.

Upvotes: 3

Related Questions