Hi, I have an html table on my website in which I want to <? php include ?> certain data (2 variables: "name" and "answer") as it is posted to the site. I have already set up the html post code, and have the following php code to write it to a text file:
Obviously this is only sufficient to store the data. I need to assign variable names to the data pieces such that the new info replaces the old, but the old is not written over. Then, I want to php echo each data piece in a different location on the html table. Let me try an example to explain:
John posts "name=John" and "answer=Red" via html form to data.txt. I want to pull "John" and "Red" out of the data file, and assign $name1="John" and $answer1="Red". When Jame subsequently posts "name=Jane" and "answer="blue" to the data file, I want her info pulled out and the variable reassigned so that $name1=Jane, $answer1=blue, and $name2=John, $answer2=red. When Pete posts "name=Pete" and "answer=green", I want $name1=Pete, $answer2=green, and $name2=Jane, $answer2=blue, and $name3=John, $answer3=red.
Can anyone point me in the right direction?