hi
i am working on php as my college assignment project now here i want do know how i can delete sub-tags in PHP / XML .i am not able to get it so please tell me how to do it ? thank you.
hi
i am working on php as my college assignment project now here i want do know how i can delete sub-tags in PHP / XML .i am not able to get it so please tell me how to do it ? thank you.
How to remove/Strip HTML tags from php $_POST variable:
1. strip_tags - tries to return a string with all HTML and PHP tags stripped from a given string. HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with allowable_tagsforeach ($_POST as $key => $value) {
$_POST[$key] = addslashes(strip_tags($value));
}
foreach ($_GET as $key => $value) {
$_GET[$key] = addslashes(strip_tags($value));
}
2. addslashes - Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote (’), double quote (”), backslash (\) and NUL (the NULL byte). It essentially runs addslashes() or mysql_real_escape_string() on all GET, POST, and COOKIE data.
Using the DOM API with PHP in a stream or XML document, it may happen that one I need to delete all sub-tags, all elements, all the nodes of a tag, for example:It's simple, provided they do not take the wrong path from the start. Indeed, one might think that for every element of our tag, delete that item. Thus it induces the use of a foreach in the well manner<? xml version = "1.0" encoding = "UTF-8"?>
<config>
<tag>
<under-tag name = "1"> Sue </ sub-tag> <! - to delete ->
<under-tag name = "2"> Benedict </ sub-tag> <! - to delete ->
<under-tag name = "3"> Camille </ sub-tag> <! - to delete ->
<under-tag = "4" name> David </ sub-tag> <! - to delete ->
</ tag>
</ config>
Bookmarks