View Single Post
Old 01-10-2007, 09:28 AM   #1 (permalink)
epochonaut
Junior Member
 
Join Date: Dec 2006
Posts: 7
Default redirect without destroying the session

I've created a form that allows registered members of my site to update their public profiles (address, email, biography, personal interests, etc). The form's ACTION attribute is "updateProfile.php" which contains the code:

<?
session_start();
(database is opened, updated with the new information and closed)
?>

<HTML>
<HEAD>
<TITLE>Update Profile</TITLE>
</HEAD>

<BODY>
<H1>Update Completed!</H1>
<A HREF="file_path">Return</A>
</BODY>
</HTML>

This works fine. The Return link takes me back to the form without destroying the session. But when I try automatically redirecting the page the session is destroyed and I have to log in again. I've used two methods of redirecting; the PHP approach:
<? header( 'Location: page_url' ); ?>

and the javascript approach:

window.onLoad = function() {
window.location="page_url";
}

How can I redirect without destroying the session? (and preferably without having to use cookies?)
epochonaut is offline   Reply With Quote
Sponsored Links