honeyroasted
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by honeyroasted
-
-
I have a survey I wrote for class and write now I'm running a script that just sends me text in an e-mail of the survey replies. I need to be able to parse the survey responses into xml so that I can make a quick table (mostly because i know what to do with xml once i have it).
So the php I'm running is from a friend of mine, meaning I really have no experience using the language ???. I guess I'll say what my html is like?
Here's an example question:
<p>
<span class="q"><b>(2) </b>If you answered <b>YES</b>, is this full-time job permanent or temporary?</span><br><br/>
<input type="radio" name="FTtype" value="PermanentFT">Permanent</input><br/>
<input type="radio" name="FTtype" value="TemporaryFT">Temporary</input><br/>
<input type="radio" name="FTtype" value="DNA">Does Not Apply</input><br/>
</p>
As you can see, the question's answers have the same "name" which can be used as the XML element, and the values can be used as the value of the xml element. Ideally, I'd like to get xml from this question looking like this:
<FTtype>PermanentFT</FTtype>
Can anyone out there help me please? :)
Saving Survey Data in XML
in PHP Coding Help
Posted
Thank you for the code - it's working!
The only problem is for questions in which there are multiple answers. The script is only grabbing 1 answer, the last one. So for a question like this, how do I get the code?
<p>
<span class="q"><b>(20) </b>During your work day, how do people contact you? (check all that apply)</span><br><br/>
<input type="checkbox" name="contactmethod" value="cell">Cell Phone<br>
<input type="checkbox" name="contactmethod" value="pager">Pager<br>
<input type="checkbox" name="contactmethod" value="telephone">Regular Telephone<br>
<input type="checkbox" name="contactmethod" value="email">Email<br>
<input type="checkbox" name="contactmethod" value="IM">Instant Messenger<br>
<input type="checkbox" name="contactmethod" value="Fax">Fax<br>
<input type="checkbox" name="contactmethod" value="inperson">In Person
</p>
It doesn't matter if I get it like:
<contactmethod>cell</contactmethod>
<contactmethod>page</contactmethod>
As in, I don't need the answers embedded in their own hierarchy.