saving query while redirecting