File read/write with text file and arrays problem
<p>I have a jsfiddle and have edited it to include sessions for passing values that the user inputs. Currently it does regex checking for phone numbers and parses the value in textbox into an array.
It uses localStorage to save the numbers in the list..</p>

<p><a href="http://jsfiddle.net/y8Uju/17/" rel="nofollow">http://jsfiddle.net/y8Uju/17/</a></p>

<p>Currently it takes numbers into that textbox and adds them to the list.  What I want to do is I want name and number to all be in that one textbox and both to be added into the list together WITH error checking. Now the real problem is that once the array passes the list over once you hit submit, I want to read those array values all into a textfile line by line for each array item.</p>

<p>So for example,
if a user enters 903456346346 kergfer kerger, due to the invalid number it should give error and tell them to redo...</p>

<p>but if their lists looks like:
2195679876 John Polski          (array item 1)
2195395676 Cara Polski          (array item 2)
2195679346 Jennifer Ray          (array item 3)
2195456756 Matt Hardy          (array item 4)</p>

<p>then they submit, it should make the textfile look like this:
2195679876 John Polski<br>
2195395676 Cara Polski<br>
2195679346 Jennifer Ray<br>
2195456756 Matt Hardy</p>

<p>I know how to put all the text in a file into one line but thats not how I want it. I want it sorted like the above. I would really liek to use a db for this but I have never used one and they seem kind of complicated...Any tutorial I found starts off with prior knowledge of command-line so I am stuck and decided to either use sessions with session life set to 4 years OR use plain ol text file. The below is what I have and it puts everything into one line..</p>

<pre><code>$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
echo $theData;
</code></pre>
