By URL Variables, I mean the (file)?variable=value type thing, I know you can use
header("Location: ".$_SERVER['HTTP_REFERER']."?variable=value");
exit();
but that also returns the previously used variable in the URL, causing it to look like:
https://(url).com/file.php?error=error?error=error?error=error?error=error
after a few times. Is there a way to remove all the? variables after the file extension or is there a function in PHP for redirecting the user back to the last page but dropping those variables?