sending variables before a redirect??

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
josboogz
Forum Newbie
Posts: 12
Joined: Thu Feb 06, 2003 5:05 am

sending variables before a redirect??

Post by josboogz »

Hi all,

I was wondering is it possible to send all the variables within a form to another page just before using the redirection command in PHP, i.e. header("Location:address.php"). I know by posting or getting in forms is the easiest way but is the way i described possible?

thanks for ur time,


Jos
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Good question. I never did get to the bottom of that issue so i just used html meta tags to do my refreshing.

Code: Select all

<meta http-equiv="refresh" content="5; url=page.php">
I don't like the fact that header() doesn't have a delay like the meta tag does. Hopefully it will in a later release of php.
User avatar
Stoker
Forum Regular
Posts: 782
Joined: Thu Jan 23, 2003 9:45 pm
Location: SWNY
Contact:

Post by Stoker »

header() is a a function that outputs data in the http header which is always sent before any content, so there is no way you can force a delay after page content is output by manipulating any headers..

Doing an 'invisible' post or get to another page behind the sceenes is possible with curl or standard (http) file functions, if you just want to pass the data on to the redirected page you can do that either by urlencoded data in the new url (get) or by creating a session and storing the data in it..
josboogz
Forum Newbie
Posts: 12
Joined: Thu Feb 06, 2003 5:05 am

Post by josboogz »

Cheers guys will look into it.

Thanks for reply, much appreciated.

jos
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Stoker wrote:header() is a a function that outputs data in the http header which is always sent before any content, so there is no way you can force a delay after page content is output by manipulating any headers..
I know all that, what i was getting at with my bitching was the fact that they should, along with the already existing header("location: http://blah.com"), a new built in function that works similar to the HTML meta refresh. But this new one let's the page load instead transport a user before.
Post Reply