Reputation: 10327
How to Clear the Query string.
my query string is "index.php?name=sugumar&id=49"
using meta tag I redirect the same page. that time the query string values are not cleared. for that I have used.
Request.QueryString[1] = string.Empty;
but it shows the error.
syntax error, unexpected '[' in /home/sugumar
Then I used
Request.QueryString.Clear();
it shows the error
Call to undefined function Clear() in /home/sugumar
how to solve this problem? I want to clear the query string values before the meta tag redirect the page.
Upvotes: 1
Views: 6764
Reputation: 382646
Try:
unset($_SERVER['QUERY_STRING']);
Other possibility is to simply not specify the query string values when you are redirecting:
header('LOCATION: page.php');
Or
<form action="<?php $_SERVER['PHP_SELF']?>">
<form action="page.php">
If that's how you are doing it.
Upvotes: 3
Reputation: 1961
If you are using meta refresh you can not clear the query string.
I would suggest using the header() function in php to redirect instead
header("Location: index.php");
Upvotes: 2