How can I remove the HTML tags from my string? Please help, I would appreciate if you could provide the code.
How can I remove the HTML tags from my string? Please help, I would appreciate if you could provide the code.
You could use this code, it will solve your query.
$newstring=strip_tags($oldstring);
I found the below script in one of the forum I participate normally, hope this is useful:
// If I take the end tag off of the following line, the only word displayed is This
$subject = 'This <script Inside the karats> can be seen';
$tag_string = $subject;
$comments = 'This is the comments .. <script window.open><This is not seen>This is seen.';
$subject = strip_tags($tag_string, "<script");
$comments = strip_tags($comments, "<script");
echo 'Check out Subject .. no Karats ' . $subject ;
echo '<br />';
echo '<br />';
echo 'Check out Comments .. no Karats ' . $comments ;
Thanks. Example of PHP site:
Code:<?php $text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>'; echo strip_tags($text); echo "\n"; // Allow <p> and <a> echo strip_tags($text, '<p><a>'); ?>
Bookmarks