on-internet
← Community

Issue with Output from DOMDocument [duplicate]

Stack Overflow ·

I'm using DOMDocument to find and strip out some HTML elements I don't want in the PHP variable $table_data_for_db. The raw version of $table_data_for_db comes with some HTML tags I don't want. So, I'm using the code below to get rid of some tags (and the content in those tags), then saving the remaining HTML to my DB. Here's the code I'm using to create $table_data_for_db... $table_data_for_db = $_POST['table_data']; $dom = new DOMDocument; $dom->loadHTML($table_data_for_db); $xPath = new DOMXPath($dom); $nodes = $xPath->query('//*[@id="problem_header"]'); if($nodes->item(0)) { $nodes->item(0

Comments

Sign in or sign up to comment and upvote.

No comments yet.