I have this problem and I can not solve it, the form is correct but when the user clicks the save button, the file save.php is triggered normally, but loses the contents of $ _POST .... Help me! p>
index.php file
<!DOCTYPE html>
<html lang="pt" class="no-js">
<body>
<div>
<div>
<form action="salvar.php" method="post">
<div class="row">
<div class="form-group">
<label for="name">Id</label>
<input type="text" class="form-control" name="id" value="">
</div>
<div class="form-group">
<label for="name">Código</label>
<input type="text" class="form-control" name="codigo" value="">
</div>
<div class="form-group">
<label for="name">Descrição</label>
<input type="text" class="form-control" name="descricao" value="">
</div>
</div>
</form>
</div>
<div>
<button type="submit" onclick="salvar()">Salvar</button>
<button type="button" onclick="fechar()">Cancelar</button>
</div>
</div>
<script type="text/javascript">
function salvar() {
window.location.href = "salvar.php";
}
</script>
</body>
</html>
In the file save.php I read the variable $ _post and the value is empty, as I show in the attached file.
save.php file
<!DOCTYPE html>
<html lang="pt" class="no-js">
<body>
<?php
var_dump($_POST);
?>
</body>
</html>
Result:
C: \ wamp \ www \ save.php: 5: array (size = 0) empty
I can not solve it and I have already lost the whole Sunday. I did not change version of anything, no update. Good week to all and thank you for wasting your time.