HI,
How can I extract a portion of a quesrystring?
I came up with the following function to use with header(). Got tired of having to rewrite the bit about including existing quesrystrings along with the new message I wanted to send in the URL paramater. Here it is:
function actnRdrct($file, $message) {
$qs = "mssg";
$goto = $file;
if ((isset($message)) && ($message != "")) {
$goto .= "?".$qs."=".$message;
}
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")) {
$goto .= (strpos($goto, '?')) ? "&" : "?";
$goto .= $_SERVER['QUERY_STRING'];
}
return $goto;
}
$mylink = actnRdrct("file.php", "delete");
produces: file.php?mssg=delete&existing=querystring
AND here is my problem with it.
It works but . . . When used consecutively the "mssg" string is duplicated. How can I delete the "mssg" if it already exists in the current querystring or change the value so that it is not duplicated.
I hope that was clear.
I'd greatly appreciate any help. Thanks
Koray