So I have a form that has 4 inputs, 2 text, 2 hidden. I\'ve grabbed the two text input values from the name, which are (get_me_two, get_me_three) and I\'ve also grabbed the
If you use DomDocument
, you could do the following:
loadHTMLFile('form_show.php');
// 1. get all inputs
$nodes = $dom->getElementsByTagName('input');
// 2. loop through elements
foreach($nodes as $node) {
if($node->hasAttributes()) {
foreach($node->attributes as $attribute) {
if($attribute->nodeName == 'type' && $attribute->nodeValue == 'hidden') {
$hidden_inputs[] = $node;
}
}
}
} unset($node);
// 3. loop through hidden inputs and print HTML
foreach($hidden_inputs as $node) {
echo "" . htmlspecialchars($dom->saveHTML($node)) . "
";
} unset($node);
?>