Hello,
I have an XML file like this:
I would like to have a PHP script that outputs the exact part of XML file when url is written by a query criteria. For exampleCode:<?xml version="1.0"?> <document> <symptoms> <symptom> <type>general</type> <area>legs</area> <title>Ankle Pain</title> <url>/symptoms/symptom-1.html</url> <contentID>anklePain</contentID> </symptom> <symptom> <type>female</type> <area>abdomen_pelvis</area> <title>Bleeding After Menopause</title> <url>/symptoms/symptom-2.html</url> <contentID>BleedingAfterMenopause</contentID> </symptom> <symptom> <type>male</type> <area>abdomen_pelvis</area> <title>Blood in the Urine in Men</title> <url>/symptoms/symptom-3.html</url> <contentID>bloodintheurineinmen</contentID> </symptom> </symptoms> </document>
http://www.mydomain.com/script.php?t...abdomen_pelvis
will output:
and for example if the query criteria is "male": www.mydomain.com/script.php?type=maleCode:<document> <symptoms> <symptom> <type>male</type> <area>abdomen_pelvis</area> <title>Blood in the Urine in Men</title> <url>/symptoms/symptom-3.html</url> <contentID>bloodintheurineinmen</contentID> </symptom> </symptoms> </document>
the output should contain both general and male tags in xml file ( or if the criteria is "female" it should take "female" and "general" tags):
I am new at PHP, I've tried something but I couldn't get the result I want. I don't know it is a complex problem or not. Can you please help?Code:<document> <symptoms> <symptom> <type>general</type> <area>legs</area> <title>Ankle Pain</title> <url>/symptoms/symptom-1.html</url> <contentID>anklePain</contentID> </symptom> <symptom> <type>male</type> <area>abdomen_pelvis</area> <title>Blood in the Urine in Men</title> <url>/symptoms/symptom-3.html</url> <contentID>bloodintheurineinmen</contentID> </symptom> </symptoms> </document>
Thank you.



Reply With Quote
If a database is simply not an option, we can use xml; but for this purpose a database is the better choice, by a longshot.


Bookmarks