PHP - DomDocument getElementsByTagName('smth')->item($string); -
i'm using form insert data xml file. data comes input field, , don't know how can write on goodbye or bye depending on data of input field using this.
$hello = $xdoc->getelementsbytagname('b')->item($idofbtag);
and xml
<a> <b id="bye"> <name>john</name> </b> <b id="goodbye"> <name>emma</name> </b> </a>
domnodelist::item()
takes integer argument index of item. in case 0
"bye" , 1
"goodbye".
but can use getelementbyid()
:
$hello = $xdoc->getelementbyid($idofbtag);
Comments
Post a Comment