Combined two questions
I have a form that submits data 1 entry per line:
data 1
data 2
data 3
(the data can be anything or any length, and any ammount of lines, but they are always different lines separating data..
So I guess I could split them appart at "\n" right?
Now since there could be 1 line, or 10 lines, what is the quickest way to do that?
I was thinking of using:
code:
list ($item1, $item2) = split ('[\n.-]', $formdata);
Two things I don't know.
How can it be done so that it can accept more than 2 items?
Is "[\n.-]" correct?
The second question is. That data is saved in an XML file such as:
quote:
<xml>
<content>
<data>item 1</data>
<data>item 2</data>
</content>
<content2>
<data>item 1</data>
<data>item 2</data>
</content2>
</xml>
now how could I extract the data from the xml file? so that it could be put back in the form?
Does anyone know of a simple PHP3 routine that would basically break up content and content2, then breakup each "data"?
I know once it is extracted, I could use the following to put it back in the form:
code:
$data = "$item1\n$item2";
but how do I get it out of the XML file to do so?
BTW: Currently using PHP3 not PHP4, since that is what I found works best when I use PHP on my own box., PHP4 was causing nothing but errors. Besides, it's not going to be a huge script, just a simple script, thus not worth the time and hassle upgrading at this point.