You can do what you mention in the comments of
The user can see a blank window before redirecting to the previous page.
- Doing a
history.back(-1) can dislocate the web application (although if this happens, you have more serious problems).
That's why I would recommend that you redirect it directly with PHP, using the function
header that you also mention in the question. For what you comment, all you need to do is pass the parameter with the ID. But that's simple if the URL is
view_fases.php?iddrs=2 then your code would be something like this:
// lee el valor del parámetro iddrs
$iddrs = $_GET["iddrs"];
// haz las operaciones que tengas que hacer para la actualización
// redirecciona a la página anterior
header("Location:view_fases.php?iddrs=" . $iddrs);
An important fact to keep in mind: the redirection with
header will give an error if some content has been written before (with
var_dump , etc.), because it can not be changed the header information once the data output has started.