Page 1 of 1

Redirect to a webpage

Posted: Thu Jan 13, 2011 3:53 am
by gunjannigam
Hi,
I am a novice programmer at PHP. I want to redirect my webpage to another webpage. The problem is that First I want to output a file as an attachment and then redirect the web page
I have used this code to output the attachment file

Code: Select all

header("Content-Disposition: attachment; filename=$filename");
echo $out;
where $out is the text I want to write in my attachment file.
Now Since I have used echo here I cant use

Code: Select all

header("location:");
to redirect my webpage. I have also tried to use ob_start() and ob_end_flush() but then my file wont be outputted as an attachment. What should I do?

Re: Redirect to a webpage

Posted: Thu Jan 13, 2011 3:55 am
by Benjamin
:arrow: Moved to PHP - Code