PHP Show the time you clicked the button and by whom it was clicked

1

Next, I'm creating an employee page that will work in the "hitting card" scheme. That is, whenever the employee arrives, he will click on 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 "battery card" again and show the time. At the end of the day, this would be "reset" (that is, the button would come back) and the time, date, and such things would go into the employee's history. BUT, I have no idea how to do this, since my programming knowledge is not so advanced.

I do not know how to make the cute date appear on the table next to it. I tried to make an if, it includes an isset. Anyway, I tried several methods but I have no idea how to do this. I am 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 IS:

    <?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;

}
    
asked by anonymous 06.10.2017 / 00:04

1 answer

0

Pretty cool, assuming you know the code, which is simple, I'll just give the logic.

1- Make a small form, where the employee enters the registration ($ enroll) and gives the submit via the button. 2- On another page you get $ enrollment per POST and save it in the bank as well as the exact moment the bank updated.

Small sample processing:

<?php
include("db.php");
$matricula    = $_POST['matricula'];
$fuso         = mktime(date("H")-3, date("i"), 0);
$hora_ponto   = gmdate("Y-m-d H:i", $fuso);

$ponto = $conexao->exec("INSERT INTO 'funcionarios' ( 'matricula' , 'hora_ponto') VALUES ('$matricula', '$hora_ponto')");
$ultimaid = $conexao->lastInsertId();
echo '<center>Registro: '.$hora_ponto;}
header("location: suapagina.php");
?>

At the end of the month you can easily print a report of all records entered by the x-plate.

I believe that with this you can do any tweak necessary to adapt to your need.

    
06.10.2017 / 00:34