0
I am placing a command inside a script so that when the User presses the "Submit" button, it is recorded given in the database and soon after this happens a page redirection:
<script type="text/javascript">
function cadAlterar (){
<?php
$idComp = (@$_POST['id']);
$insert = mysql_query("INSERT INTO alterar(idComp) VALUES ('$idComp')");
?>
location.href="altCompras.php";
}
</script>
I save the data in the database, but in return there is no redirection.
Try
header('Location:altCompras.php');
see if it meets the problem of redirecting. Remembering that this should be placed just below theinsert
php.– user28595
I tried that, but it didn’t work either
– Eduardo Balestrin
Here’s everything about PHP Directs: http://stackoverflow.com/questions/768431/how-to-make-a-redirect-in-php
– Nuno Patrão
how "saved right" is mixing javascript function with php.?
– Daniel Omine