1
Next, I’m creating a page of employees that will work in the "punch card" scheme. That is, whenever the employee arrives, he will click the button inside the system and the intention was to show the time that was clicked and stay there. Then, when he left, he would "hit card" again and show the time. At the end of the day, this would be "zeroed" (i.e., the button appeared again) and the time, date and these things would go into the employee’s history. However, I don’t have much idea how to do this, since my knowledge of programming is not so advanced.
I do not know how to make appear the cute date in the table next. I tried to make an if, includes an isset. Anyway, I tried several methods but I have no idea how to do it. I’m open to suggestions, opinions. I really need to do this!
Thank you!
<?php
include './abreConexao.php';
$sqlFunc = "Select * from FUNCIONARIOS";
$rsFunc = mysql_query($sqlFunc) or die (mysql_error());
?>
<table border="1">
<?php
while($tblFunc = mysql_fetch_array($rsFunc)){
?>
<tr>
<td>
<?=$tblFunc['nome_FUNCIONARIO']?>
</td>
<td align="center">
<form action="Funcionarios.php" method="POST">
<input type="submit" value="" name="horaEntrada">
</form>
</td>
<td align="center">
<input type="submit" value="" name="horaSaida">
</td>
</tr>
<?php
} ?>
</table>
WHAT I TRIED TO DO WAS:
<?php
$horaEntrada = $_POST['horaEntrada'];
if(isset($_POST['horaEntrada'])){
$horaEntrada = 1;
}else{
$horaEntrada = 0;
}
if($horaEntrada == 1){
date_default_timezone_set('America/Sao_Paulo');
$date = date('Y-m-d H:i');
echo $date;
}
You can’t understand where the difficulty is. Can you explain it better, please? Do you already have a database? A feature like this requires a database.
– bfavaretto
Yes, I have the database, the employee table included.
– nathwlia
My main difficulty is: how do I do this scheme of "hit card". If it does not click, there will be the option. When the particular employee clicks (i.e., on his "part") make appear the cute date. I even managed to get the date out, but I don’t know how to get this idea to stick to the employee who clicked and then automatically reset and go to the history. I don’t know if you understand...
– nathwlia
I think you better show the relevant snippets of the code. Maybe it’s material for more than one question.
– bfavaretto
Vish, there’s so much... I only send what’s on the staff page?
– nathwlia
Just put the snippet where you think the problem is. If possible by cutting unnecessary parts
– bfavaretto
Well, I put what I had tried to do (kind of silly, but that’s what came into my head to solve) and also put the page that I’m doing, but I cut some parts that I thought were unnecessary. My first question is: Do I php on the employee page itself or create another one? If I create another, how to retouch to the employees page with the changed information?
– nathwlia