I am using a scorm quiz that can export data to my server as xml. I am trying to parse that data so that I can use some of it to send in a php email. What I am trying right now returns the number 1 and I can't figure out how to make it work. Help?
<?php
$version = $_POST['v'];
$points = $_POST['sp'];
$passing_percent = $_POST['psp'];
$gained_score = $_POST['tp'];
$username = $_POST['sn'];
$email = $_POST['se'];
$quiz_title = $_POST['qt'];
$detailed_results_xml = $_POST['dr'];
$xml_string = <<<_XML
print "<?xml version="1.0" encoding="iso-8859-1"?>" . $detailed_results_xml;
_XML;
$xml = simplexml_load_string($xml_string);
$emailtest = print_r($xml);
mail("email@email.com",$quiz_title,$emailtest,"From: fromname <noreply@test.com>");
?>
If I email the $detailed_results_xml to myself it comes through like this:
<quizReport xmlns="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ispringsolutions.com/ispring/quizbuilder/quizresults quizReport.xsd" version="1">
<quizSettings quizType="survey" timeLimit="0"/>
<summary time="32">
<variables>
<variable name="USER_NAME" title="Name" value="mike"/>
<variable name="USER_EMAIL" title="Email" value="test.test@test.com"/>
</variables>
</summary>
<questions>
<fillInTheBlankSurveyQuestion id="{BE7284DD-B731-409B-9198-A782499EECA9}" status="answered">
<direction>Exercise 1: Current Sleep Habits (Night 1)
In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
Example:
Day of Week
Sunday
Time to Bed At Night
11:30 pm
Time in Bed Before As!
leep (estimate)
1 hour
Time Awake in the Morning
6:30 am
Quality of Sleep (1 to 5)
3
Total Time Sleeping
6 hours </direction>
<details>
<text>
<![CDATA[Day of Week]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time to Bed At Night]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time in Bed Before Asleep (estimate)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time Awake in the Morning]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Quality of Sleep (1 to 5)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Total Time Sleeping]]>
</text>
<blank userAnswer=""/>
</details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{F52AC41C-C149-4B8D-9976-5F380B1A7851}" status="answered">
<direction>Exercise 1: Current Sleep Habits (Night 2)
In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot o!
f your current sleep habits.
Example:
Day of Week
Sunday!
Time to Bed At Night
11:30 pm
Time in Bed Before Asleep (estimate)
1 hour
Time Awake in the Morning
6:30 am
Quality of Sleep (1 to 5)
3
Total Time Sleeping
6 hours </direction>
<details>
<text>
<![CDATA[Day of Week]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time to Bed At Night]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time in Bed Before Asleep (estimate)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time Awake in the Morning]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Quality of Sleep (1 to 5)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Total Time Sleeping]]>
</text>
<blank userAnswer=""/>
</details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{4F33A341-308C-493E-BF98-E13927064BC5}" status="answered">
<direction>Exercise 1: Current Sleep Habits (Night 3)
In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 !
being bad and 5 being great. This will give you snapshot of your current sleep habits.
Example:
Day of Week
Sunday
Time to Bed At Night
11:30 pm
Time in Bed Before Asleep (estimate)
1 hour
Time Awake in the Morning
6:30 am
Quality of Sleep (1 to 5)
3
Total Time Sleeping
6 hours </direction>
<details>
<text>
<![CDATA[Day of Week]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time to Bed At Night]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time in Bed Before Asleep (estimate)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time Awake in the Morning]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Quality of Sleep (1 to 5)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Total Time Sleeping]]>
</text>
<blank userAnswer=""/>
</details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{324BFC55-6E6D-48EF-9B0F-341131988317}" status="answered">
<direction>Exercise 1: Current Sleep Habits (Night 4)
In this exercise, think about the last few nights!
of sleep. Write the amount of time you slept per night and rate the qu!
ality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
Example:
Day of Week
Sunday
Time to Bed At Night
11:30 pm
Time in Bed Before Asleep (estimate)
1 hour
Time Awake in the Morning
6:30 am
Quality of Sleep (1 to 5)
3
Total Time Sleeping
6 hours </direction>
<details>
<text>
<![CDATA[Day of Week]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time to Bed At Night]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time in Bed Before Asleep (estimate)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time Awake in the Morning]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Quality of Sleep (1 to 5)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Total Time Sleeping]]>
</text>
<blank userAnswer=""/>
</details>
</fillInTheBlankSurveyQuestion>
<fillInTheBlankSurveyQuestion id="{96C36841-A582-4059-A408-8D8EA0CC09E6}" status="answered">
<direction>Exercise 1: Current Sleep Habits (Night 5)
!
In this exercise, think about the last few nights of sleep. Write the amount of time you slept per night and rate the quality of your sleep on a scale of 1 to 5, with 1 being bad and 5 being great. This will give you snapshot of your current sleep habits.
Example:
Day of Week
Sunday
Time to Bed At Night
11:30 pm
Time in Bed Before Asleep (estimate)
1 hour
Time Awake in the Morning
6:30 am
Quality of Sleep (1 to 5)
3
Total Time Sleeping
6 hours </direction>
<details>
<text>
<![CDATA[Day of Week]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time to Bed At Night]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time in Bed Before Asleep (estimate)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Time Awake in the Morning]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Quality of Sleep (1 to 5)]]>
</text>
<blank userAnswer=""/>
<text>
<![CDATA[ Total Time Sleeping]]>
</text>
<blank userAnswer=""/>
</details>
</fillInTheBlankSurveyQuestion>
<essayQuestion id="{C91C6866!-63A1-4BE5-84DD-1A0F8C34FB1F}" status="answered">
<direction>Exercise 2:!
Regulate the Body’s Clock through Daily Routine
Some people use a morning routine to help them wake up and a bedtime routine of relaxing activities to prepare their bodies for sleep. These activities of daily living act as “cues†to signal the brain to fall into biological rhythms.
In this exercise, consider for a minute what you did last night before bed and what you’ve done so far today.
Take a moment to describe your daily routine and activities starting with last night.
Evening activities at work, school, community or home: </direction>
<userAnswer>asdfasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{AFE522F8-6D34-4434-BC41-61E7121615FD}" status="answered">
<direction>Relaxing activities before bedtime: </direction>
<userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{50E422B5-7705-49D6-9CFC-CF1E97389D10}" status="answered">
<direction>
Sleep Routine (time to bed, personal care activities, medication, and time, if awoken): </direction>
<userAnswer>asdfsdfads</userAnswer>
</essayQuestion>
<essayQuestion id="{6DF65956-6976-446F-87DD-02CD0A88FA14}" status="answered">
<direction>Wake up routine (time awake, personal care activities, medication time): </direction>
<userAnswer>asdfdfasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{CF38A3C2-E538-41B1-92C1-15011126231D}" status="answered">
<direction>Morning activities at work, school, community or home: </direction>
<userAnswer>asdfdfasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{CAA971E7-4722-4900-9667-4CF7B283A95C}" status="answered">
<direction>Afternoon activities at work, school, community or home: </direction>
<userAnswer>asdfasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{2A64580E-A99C-4525-8435-2C57ECCBCEFB}" status="answered">
<direction>Exercise 3: Planning for Improvement
In this brief exercise, you’ll consider all that you’ve come to realize about your own habits and routine and take a moment to reflect on some small changes that might!
benefit you.
Use the space below to make a short list of small chang!
es you can make to your own routine that might prevent sleep loss. As you’re doing this, consider some of the following questions:
What changes, if any, have I made in the past that have worked for me? </direction>
<userAnswer>asdfsad</userAnswer>
</essayQuestion>
<essayQuestion id="{6EB6CCF7-045A-4E8B-AFA0-794F00FEB658}" status="answered">
<direction>Are there some changes that have not worked? </direction>
<userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{99CBF95D-7427-4999-BF93-6D727D607B0A}" status="answered">
<direction>A few small changes I can make to improve my sleep and health: </direction>
<userAnswer>asdfsasdf</userAnswer>
</essayQuestion>
<essayQuestion id="{E3621400-19BD-4200-A8A2-DE6544EFAD65}" status="answered">
<direction>If I make this change, how might it impact my life/Life Goals? </direction>
<userAnswer>asdfasdfa</userAnswer>
</essayQuestion>
Sorry if the formatting got messed up on the xml bit but you should get the idea from it I think. So the xml bit is what gets generated by $detailed_results_xml and I need to parse some pieces of it to html to send in an email, but right now I am only seeing a number 1. Any help is greatly appreciated!