I have two small problems that I have to solve to solve, let's go to the first one:
1- I have the code below right after my submit to verify that the data has been filled out:
<?php
$data_coleta = $_POST["data_coleta"];
$hora_coleta = $_POST["hora_coleta"];
$unidade = $_POST["unidade"];
$observacao = $_POST["observacao"];
$solicitante = $_POST["solicitante"];
$coletadora = $_POST["coletadora"];
$erro = 0;
// Verifica se os campos não estão em branco
if (empty($data_coleta))
{echo "Favor inserir a Data da Coleta.<br>"; $erro=1;}
if (empty($hora_coleta))
{echo "Favor inserir a Hora da Coleta.<br>"; $erro=1;}
if (empty($unidade))
{echo "Favor inserir a Unidade.<br>"; $erro=1;}
if (empty($observacao))
{echo "Favor inserir a Observação.<br>"; $erro=1;}
if (empty($solicitante))
{echo "Favor inserir o Solicitante.<br>"; $erro=1;}
if (empty($coletadora))
{echo "Favor inserir a Coletadora.<br>"; $erro=1;}
//Verifica se não houve erro
if($erro==0)
{echo "<center>Todos os dados foram inseridos corretamente!</center>";
include 'insere.php';
}
?>
The problem is that PHP is returning an error saying that the variables have no value defined, because it has not yet been submitted in the form to define the values (which is what is inserted by the user), I imagine which I then need to do an if to just do that values check after being given the submit, how to do?
I think there is something in the Bootstrap JS that I'm using that asks that when updating the page should return to the top, so I can not direct the form's action to the div that I need, JS of the button to go to the top :
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1200);
});
});
</script>
<a href="#" id="toTop" style="display: block;"><span id="toTopHover" style="opacity: 1;"></span></a>
Tips?