-1
I have the following problem: I am not able to take the current time and insert it in the bank.
<div class="container">
<h2>Registrando ponto</h2>
<form class="form" method="POST" action="registroHora.php">
<button type="submit" class="btn btn-primary" name="codEntrada">Entrada</button>
<button type="submit" class="btn btn-primary" name="codSaida">Saída</button>
</form>
</div>
<?php
session_start();
include_once("conexao.php");
$codEntrada = $_POST['codEntrada'];
$codSaida = $_POST['codSaida'];
$codUser = $_POST['codUser'];
$sql = "insert into registroPonto (codEntrada, codSaida, codUser)
values('$codEntrada', '$codSaida', '$codUser')";
$sql = mysqli_query($conn, $sql);
if(mysqli_insert_id($conn)){
$_SESSION['msg'] = "Ponto Registrado";
header('location: area-usuario.php');
}
else
{
$_SESSION['msg'] = "Usuário não Cadastrado.";
header('location: cadastro.php');
}
?>
create table cadastroUsuario(
codUser int not null auto_increment primary key,
userNome varchar(100) not null,
userEmail varchar(100) not null,
userSenha varchar(100) not null,
userConfirmaSenha varchar(100) not null
);
create table registroPonto(
codPonto int not null auto_increment primary key,
codEntrada datetime not null,
codSaida datetime not null,
codUser int not null,
constraint fk_ponto_usuario FOREIGN KEY (codUser)
REFERENCES cadastroUsuario (codUser)
);