-2

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!

4

1 回答 1

0

检查 parse_url 和 parse_str 函数。

http://www.php.net/manual/en/function.parse-url.php

http://php.net/manual/en/function.parse-str.php

于 2013-08-02T14:41:39.370 回答