View Full Version : php redirect
danulf
March 27th, 2007, 12:00 PM
I decided yesterday that it would be cool to know some php, so I installed it and started looking at some tutorials. I hit a bit of a snag when I started experimenting myself though. I have an upload form, very basic, it sends a file to a destination and displays the files in that folder. Right now I have the directory list and upload form at the same page, and I like it that way. When the file have been uploaded, you get a popup saying that the upload succeeded, if it didn't, you get a popup saying that. Now what I want is to be redirected back to the index (with the upload form/dir list), and keeping the popups. If I use the header(Location: 'blebb.html'); it just redirects back, it doesn't show the popups, echoes, whatever. Is there an other way of doing this?
Hope my explanation made sense :D
Nevo
March 27th, 2007, 12:08 PM
Could you ignore PHP and jsut use a general meta redirect after displaying a sucess/failed upload message?
<meta http-equiv="refresh" content="10;url=http://abc.com/dir">
danulf
March 27th, 2007, 12:13 PM
well... yeah.... that works... I should've thought of that :D
Thanks!
EDIT: out of curiosity, is there a way to redirect in php that executes after the things above it? I mean, if something pauses everything (like an alert message), it doesn't redirect until 'OK' is pressed?
Nevo
March 27th, 2007, 12:22 PM
/cheer
foodpk
March 27th, 2007, 01:18 PM
I don't think so, PHP is serverside, so that means everything it does is done on the server and then sent to you. For timed redirects, you should use the meta tag or javascript.
danulf
March 27th, 2007, 02:00 PM
ok, good to know!
P.S. Really like the new footer/avatar! :thumb:
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.