I'm having a hard time with XPath here.. Given the following XPath queries:
$xpath->query('//input[@name="' . $field . '"]');
$xpath->query('//select[@name="' . $field . '"]');
Is is possible to combine them into one single query? I want to get the value of the field, however I don't know if the field with be a input, select, textarea...
The way I'm doing it now is like this:
$input = $xpath->query('//input[@name="' . $field . '"]');
if (empty($input) === true)
{
$select = $xpath->query('//select[@name="' . $field . '"]');
if (empty($select) === true)
{
// ...
}
}
However it seems to cumbersome, I'm sure there must be a way to merge all the queries into one.