So I have created this attendance system where you can add photos of each person and the person can click their photo and it will let you know that they have checked in. However I have a little issue. When you click on a photo, it says every person added to the system has been checked in. Can anyone give me suggestions on what I can do to make each picture become a seperate button and also when you click on that picture the name associated with that picture will be the only one that is checked in.
I know I am using a text file for practice purposes but when I figure out how to make it work correctly I plan on using the MySQL database with php for storing the check in/ check out data.
Also when you enter the page it automatically checks everyone in.
Here is the link. It's a full system. You have to register, then login, then click the check in button at the top left to see the Check in page.
https://bluebrazentech.com/login/martinenrichment/register.php
access code: mea2018
Here is the part my code below that shows how I wrote the check in functionality. Thank you in advance.
while ($row = mysqli_fetch_array($result)) {
echo "<div id='img_div'>";
echo "<form method = 'post' action=''>";
// this is how I make each photo into a button
echo "<input type ='image' id = 'myImg' width = '80%' alt = 'Submit' src='upload/".$row['image']."' />";
echo "<p>".$row['first_name']."</p>";
echo "<p>".$row['last_name']."</p>";
echo "</form>";
echo "</div>";
// when they click the photo this will give them a timestamp with their name but multiple names are coming up instead of the name connected to the photo.
date_default_timezone_set("America/Chicago");
$fp = fopen("timetracker.txt", "a");
$timestamp = date("l jS \of F Y h:i:s A");
$savestring = $timestamp . " $variable1 " . $row['first_name'] . " $variable1 " . "clocked in" . "\n";
fwrite($fp, $savestring);
fclose($fp);
$file = fopen("timetracker.txt", "r");
}
?>
<pre>
<?php
while ($line = fgets($file)){
echo $line;
}
?>
</pre>