Giving ids to nested xml data attributes, in php

htrommler

New Member
I've got a data feed I'm importing that has a load of 'markets', I want to have a main page displaying all the markets, so for that id use a \[code\]foreach\[/code\] loop to go through the data and on each market make a listing. Each market has a bunch of attributes as well as nested participants, I want to then make a page for each market, that displays some information about each participant.So the user would navigate to index.php > event.php?id101This is the bit were ive become stuck, how can i send the user to the right page, I was thinking of using \[code\]<?php $xml = simplexml_load_file('f1_feed.xml'); foreach($xml->response->williamhill->class->type->market as $event) { $event_attributes = $event->attributes(); echo "<tr>"; // EVENT NAME WRAPPED IN LINK TO EVENT echo "<td>"; echo '<a href="http://stackoverflow.com/questions/14508268/event.php?id=' . $market_id . '">'; echo $event_attributes['name']; echo "</a>"; echo"</td>"; // DATE echo "<td>"; echo $event_attributes['date']; echo "</td>"; echo "</tr>"; } ?>\[/code\]but how can I set a var \[code\]$market_id\[/code\] (from the xml feed) to add to the end of the url, so it sends me to the right page ? (f1_feed.xml is the same as the live xml feed, its just local for development)the feed I'm using is http://whdn.williamhill.com/pricefe...arketType&classId=5&marketSort=HH&filterBIR=Nwhich im bring in using simplexml
 
Back
Top