I need take the attribute value
using xpath, I tried several times but always get null
.
Here is my html code:
<input type="hidden" id="Lat" name="myMap" value="22.445575, -18.722164">
Code in php:
$val= $xpath->query('//input[@type="hidden" and @name="myMap"]/@value' );
$list=array();
foreach($val as $v){
$list[]=$v->nodeValue;
}
var_dump($list);
$sValue= (string)$val[0];
Notes:
- I've tried with other xpath in the same url and it works, but not with hidden input
- I've tried with
$v->item(0);
oritem(0)->nodeValue;
and they always produce the same result
this is your code using DOM xpath :