title: What is the best way to save and load an activity log in PHP?
body: <p>Before I begin, THIS IS AN ASSIGNMENT. I am just after a helping hand an some guidance :)</p>
  
  <p>I am developing a gym membership website which allows users to register, login, and book an activity.</p>
  
  <p>I have everything working, besides the activity booking system, and that is what I need guidance with. I have a single txt file that contains an activity log of each activities name, time, how many can attend in total. I would like to add to the end of each activities line of who is attending exactly. Therefore, allowing users to book the activity, which adds their username to the activity.</p>
  
  <p>This is exactly how I currently have my activity.txt file printing (besides the 'Book' buttons on the far right.</p>
  
  <pre><code>NumberOne       3       Wednesday 8am       (BOOK)
  NumberTwo       7       Thursday 10am       (BOOK)
  NumberThree     20      Monday 1pm          (BOOK)
  NumberFour      15      Tuesday 5pm         (BOOK)
  </code></pre>
  
  <p>Basically, what I need guidance with is the 'Book' buttons. Once a 'Book' button is pressed, it will book the user in to the activity.</p>
  
  <p>This is how my activity.txt file currently looks:</p>
  
  <pre><code>NumberOne,3,Wednesday 8am
  NumberTwo,7,Thursday 10am
  NumberThree,20,Monday 1pm
  NumberFour,15,Tuesday 5pm
  </code></pre>
  
  <p>And this is the code I currently have that is printing the activities:</p>
  
  <pre><code>function bookActivity()
  {
   $fileContentsArray = file("activity.txt");
      echo "&lt;table&gt;";
      foreach($fileContentsArray as $one_persons_data)
  {
    echo '&lt;tr&gt;';
    $splitted = preg_split('/,/', $one_persons_data);
    foreach ($splitted as $one) 
    {
      echo "&lt;td&gt;$one&lt;/td&gt;";
    }
    echo '&lt;/tr&gt;';
  }
  echo "&lt;/table&gt;";
  }
  </code></pre>
  
  <p>Below is my users.txt file if needed. All passwords are saved in MD5</p>
  
  <pre><code>jiten:3fc0a7acf087f549ac2b266baf94b8b1
  jb:3fc0a7acf087f549ac2b266baf94b8b1
  test:bed128365216c019988915ed3add75fb
  joeBlogg:bed128365216c019988915ed3add75fb
  userX:bed128365216c019988915ed3add75fb
  userY:bed128365216c019988915ed3add75fb
  </code></pre>
  
  <p>All help is greatly appreciated. Very confused on how to do this.</p>