gvilla23
asked on
php variable to xml
I need to pass a variable in a link where I can search for a matching node (by id) in an xml file and display it
ASKER
How would i compare the XML information to the value in $_GET, in a foreach loop
Do you have some XML to test with? If so, please post a small sample and tell me what you want to find inside the XML. I'll show you the code.
Do you have experience in PHP programming?
Do you have experience in PHP programming?
ASKER
Thanks, I want to be able to grab the node by the id, from somthing like
<a href="somelink.com?id=1">
I have a little PHP experience
<?xml version="1.0" encoding="ISO-8859-1"?>
<popups>
<popup>
<id>1</id>
<title>SQUARE ENIX MEMBERS REWARDS 2009</title>
<img_loc>images/se_member/ se_members _popup_2.j pg</img_lo c>
<client>SQUARE ENIX</client>
<involvement>DESIGN, FROM CONCEPT TO FINAL PACKAGING</involvement>
</popup>
<popup>
<id>2</id>
<title>ADENALIN MISFITS</title>
<img_loc>images/adrenaline _misfits/a drenaline_ misfits_po pup_1.jpg< /img_loc>
<client>KONAMI</client>
<involvement>KEYART DESIGN</involvement>
</popup>
</popups>
<a href="somelink.com?id=1">
I have a little PHP experience
<?xml version="1.0" encoding="ISO-8859-1"?>
<popups>
<popup>
<id>1</id>
<title>SQUARE ENIX MEMBERS REWARDS 2009</title>
<img_loc>images/se_member/
<client>SQUARE ENIX</client>
<involvement>DESIGN, FROM CONCEPT TO FINAL PACKAGING</involvement>
</popup>
<popup>
<id>2</id>
<title>ADENALIN MISFITS</title>
<img_loc>images/adrenaline
<client>KONAMI</client>
<involvement>KEYART DESIGN</involvement>
</popup>
</popups>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is purfect =), one comment, how would I load the xml externally
for example $objDOM->load("test.xml"); and not include it on the page.
for example $objDOM->load("test.xml");
You can use this function to load an external XML file http://php.net/manual/en/function.simplexml-load-file.php
Thanks for the points, ~Ray
Thanks for the points, ~Ray
To pass a variable in a link you would find the variable in $_GET. To find a node in an XML file, you would probably use the SimpleXML class to create an object and use an iterator like foreach to walk the object, comparing the XML information to the value you found in $_GET.
Do you have any experience in PHP programming?