Before I begin, THIS IS AN ASSIGNMENT. I am just after a helping hand an some guidance :)
I am developing a gym membership website which allows users to register, login, and book an activity.
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.
This is exactly how I currently have my activity.txt file printing (besides the 'Book' buttons on the far right.
NumberOne 3 Wednesday 8am (BOOK)
NumberTwo 7 Thursday 10am (BOOK)
NumberThree 20 Monday 1pm (BOOK)
NumberFour 15 Tuesday 5pm (BOOK)
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.
This is how my activity.txt file currently looks:
NumberOne,3,Wednesday 8am
NumberTwo,7,Thursday 10am
NumberThree,20,Monday 1pm
NumberFour,15,Tuesday 5pm
And this is the code I currently have that is printing the activities:
function bookActivity()
{
$fileContentsArray = file("activity.txt");
echo "<table>";
foreach($fileContentsArray as $one_persons_data)
{
echo '<tr>';
$splitted = preg_split('/,/', $one_persons_data);
foreach ($splitted as $one)
{
echo "<td>$one</td>";
}
echo '</tr>';
}
echo "</table>";
}
Below is my users.txt file if needed. All passwords are saved in MD5
jiten:3fc0a7acf087f549ac2b266baf94b8b1
jb:3fc0a7acf087f549ac2b266baf94b8b1
test:bed128365216c019988915ed3add75fb
joeBlogg:bed128365216c019988915ed3add75fb
userX:bed128365216c019988915ed3add75fb
userY:bed128365216c019988915ed3add75fb
All help is greatly appreciated. Very confused on how to do this.