Re: Close all open tags in HTML text

From: Date: Thu, 09 Dec 2004 09:00:29 +0000
Subject: Re: Close all open tags in HTML text
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-203794@lists.php.net to get a copy of this message
Matt Palermo wrote:
I am allowing users to imput HTML code into a textarea. After they input this, I wany to output their HTML to the browser. In order for the document to be safe, I need to close all open HTML tags that have been left open by the user, along with any open comments. Is there a way to take an HTML string and add closing tags and comments to it if needed? Thanks, Matt I would use a regular expression to grab the valid opening and closing HTML tags, and use something á la htmlentities() on the rest of the document.
-- Daniel Schierbeck Help spread Firefox (www.getfirefox.com): http://www.spreadfirefox.com/?q=user/register&r=6584

« previous php.general (#203794) next »