Wednesday 15 February 2012

php - To remove special characters like , - -



php - To remove special characters like <p>, <li> -

i want display content on client side. problem getting output -

<p> aliette systemic fungicide effective against oomcytes fungi downy mildew diseases of grapes , damping off , azhukal diseases of cardamom.</p> <span> despite extensive utilize since 1978, there no study of resistance development in fungus. true systemic action makes application of aliette best prophylactic solution downy mildew command in grape.</span>

now want remove special characters i.e <p>,</p>, <span>, </span>

value stored in database description = "<p> test <p>";

$sel_pro = "select * bayer_product product_group '%".$_request['searchfield']."%'"; $res_pro = mysql_query($sel_pro); $num_pro = mysql_num_rows($res_pro); while($row_pro = mysql_fetch_assoc($res_pro)) { echo $desc = strip_tags($row_pro['description']); }

if tags can utilize strip_tags().

$text = '<p>test paragraph.</p><!-- comment --> <a href="#fragment">other text</a>'; echo strip_tags($text); // allow <p> , <a> echo strip_tags($text, '<p><a>');

the outputs be

test paragraph. other text //strip tags <p>test paragraph.</p> <a href="#fragment">other text</a> //strip tags except <p> & <a>

php

No comments:

Post a Comment