Ok, so I thought I had this nailed , but sadly not . I have this XML:
//XML
this is root--> <story>
<article>
<title>my title </title>
<img>my image </img>
<link>my link </link
</article>
</story>
and then this PHP:
//php
$dom = new DOMDocument('1.0', 'UTF-8');
$dom->loadXML($_SESSION['xml']);
$xpath = new DOMXPath($dom);
$query = $xpath->query('//section/article');
foreach($query as $article ):
$currentTitle = $article->title ;
//edit - mistake in code - $article used for all
//$imagearray = $currentimg->img ;
//$linkarray = $currentlink->link ;
array_push( $availAds,$currentTitle,$imagearray,$linkarray );
endforeach;
So what I'm trying to do is get the 'Title' 'Img' and 'Link' values and insert them into a pre existing array. The array already outputs fine with the previously entered values, but I then need to be able to output the results of the updated array in this way:
printf(
'<input name="ads[%1$s][title]" value="%2$s" style="width:310px;" /><br />',
$availAd['image'],
$availAd['title']
);
The issue is right now , the foreach returns NULL for $currentTitle , $imagearray and $linkarray