I have an XML file that lists all the services I provide to my customers.
I can populate a list from this file easily.
What I'd like to do is when someone clicks on a particular service, then I display the description of that particular service.
I think I need to use xpath, but not sure how....
My xml file look like this:
<services>
<service >
<id>1</id>
<title>Website Design and Programming </title>
<desc>blah blah </desc>
</service>
<service >
<id>2</id>
<title>Database Programming </title>
<desc>wrfwrfwrf </desc>
</service>
<service >
<id>3</id>
<title>Web Development (PHP, XHTML, JavaScript, CSS, AJAX)</title>
<desc>some text </desc>
</service>
</services>
PHP code to display a list of all services:
<ul>
<?
$Data=simplexml_load_file('services.xml');
foreach ($Data->service as $service)
{
foreach ($service->id as $id)
{
foreach ($service->title as $title)
{
?>
<li><a href="display.php?Service=<? echo $id;?>" title="<? echo $title;?>"><? echo $title;?></a></li>
<? } } }?>
</ul>
On the display page I only want to show the description of the service that's been clicked.
Eventually I'd like to use jquery ajax call to load the description on the same page , but that's another story
Help is greatly appreciated, tx, kamy