yzgulec
04-01-2011, 10:53 PM
Hello,
I have an XML file like this:
<?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>
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 example
www.mydomain.com/script.php?type=male&area=abdomen_pelvis
will output:
<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>
and for example if the query criteria is "male": www.mydomain.com/script.php?type=male
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):
<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>
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?
Thank you.
I have an XML file like this:
<?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>
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 example
www.mydomain.com/script.php?type=male&area=abdomen_pelvis
will output:
<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>
and for example if the query criteria is "male": www.mydomain.com/script.php?type=male
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):
<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>
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?
Thank you.