Code:
Form:
<form action="../controller/NotPrecontrole.php" method="POST" onsubmit="return valid();">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<input type="date" name="DtInicio" value="<?php echo $DtInicio; ?>">
<input type="submit" class="round success small button" value="Aplicar"/>
<a class="round secondary small button" href="Home.php">Voltar</a>
</form>
Precontrolling:
$id = $_POST['id'];
$DsMsg = $_POST['Msg'];
$InAtivo = $_POST['InAtivo'];
$DtInicio = $_POST['DtInicio'];
$DtFim = $_POST['DtFim'];
$objNot = new Not();
$objNot->setid($id);
$objNot->setmsg($DsMsg);
$objNot->setativo($InAtivo);
$objNot->setini($DtInicio);
$objNot->setfim($DtFim);
$controller = new Notifica($conn);
if (!empty($id)){
$objNot->setid($id);
$controller->editarNot($objNot);
}
header ("location: ../view/home.php?id=".$id);
Home:
<?php
foreach ($controller->ListaNot() as $objNot){
echo '<li><a href="editNot.php?id=' . $objNot->getid() . '">Editar</a></li>';
if($DtInicio == date('Y-m-d')){
echo $objNot->getmsg();
}
}
Error:
Notice: Undefined variable: DtInicio in C: \ xampp \ htdocs \ Rasador1 \ view \ home.php on line 63
I'm trying to get the date that goes to POST in $DtInicio
and compare it with today's date to print on $objNot->getmsg();
screen, however it's giving the above error. I need to give Isset
and get it by GET
but I do not know how, any help?