I want to use PHP and DomXPath::query
to get the parent "form" element of a submit button. The variable $dom
holds the complete DOM tree and $node
represents the submit button as a DOM node.
$query = '??????';
$xpath = new \DomXPath( $dom );
$parents = $xpath->query( $query, $node );
if ( $parents->length )
{
$form = $parents->item( 0 );
}
I tried several queries, but until now I found no solution. I think it would be easy if I had more time to read about that XPath syntax. I hope you can help. :)