PHP Header Location with parameter. Delete and back to previous list

1.8k Views Asked by At

I have a list of rows with their respective links to go to "remove.php" and run "DELETE FROM" and so remove each row separately.
This list is on a dynamic page details.php?recordID=123

How could I set the header(location: ...) value including the details.php parameters?
I want to go back (Reliably) to the source list after deleting the row.

  $deleteGoTo = "details.php?recordID=123";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING']; }
  header(sprintf("Location: %s", $deleteGoTo));

Thanks!

1

There are 1 best solutions below

0
On