This is really hard to explain, I'm trying to remove a query string from my url after I've displayed the data from the string.
in file1.php I have a redirection to file2.php after some checks
header('Location: file2.php?var=somemessage');
in file2.php I echo $_GET['var']; to display the message then use javascript to remove the query string from url
if (location.href.match(/\?.*/) && document.referrer) {
location.href = location.href.replace(/\?.*/, '');
}
The problem here is that I get a notice of undifined index: var in file2.php. How do I get around this to remove the query string and still display the message?
I don't want to pass the message from a session.