Reputation: 93
I have 3 files index.php, search.php, test.php
test.php contains a script just for execution doesn't display anything I want user to automatically redirect (without delay, without displaying anything) from test.php (after execution of test.php) to where they came from
like this
index.php -> test.php ---> index.php
search.php?q=searchterm -> test.php ---> search.php?q=searchterm
I'm new to php so help anyone
Upvotes: 0
Views: 700
Reputation: 87
Any "redirect" is implemented by sending HTTP request. You have to make sure that no output was before sending headers.
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: '.$location);
where $location = 'http://yoursite.com/destination.php';
for example.
You can also send headers with GET or POST parameters if you want. See php POST variable with headers
Upvotes: 1