Redirect to a webpage

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gunjannigam
Forum Newbie
Posts: 1
Joined: Thu Jan 13, 2011 3:42 am

Redirect to a webpage

Post 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?
Last edited by gunjannigam on Thu Jan 13, 2011 4:01 am, edited 1 time in total.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Redirect to a webpage

Post by Benjamin »

:arrow: Moved to PHP - Code
Post Reply