Revision: 9124
                            
                                                            
                                    
                                        
Initial Code
                                    
                                    
                                                            
                                    
                                        
Initial URL
                                    
                                    
                                                            
                                    
                                        
Initial Description
                                    
                                    
                                                            
                                    
                                        
Initial Title
                                    
                                    
                                                            
                                    
                                        
Initial Tags
                                    
                                    
                                                            
                                    
                                        
Initial Language
                                    
                                    
                                                    
                        at October 22, 2008 06:18 by Wardy
                            
                            Initial Code
<?
    session_start();
    $_SESSION['forward'] = "This session data will not be lost!";
    session_write_close();
    header('Location: nextpage.php');
?>
                                Initial URL
http://uk.php.net/session_start
Initial Description
The problem is some times the redirect may kick you off to the next page before all the session variables have been saved. The true solution to lost session vars on redirect is to simply call session_write_close(); before setting the redirect header. This will insure that php finishes writing the session info before page redirect gets underway.
Initial Title
Save session value - then header redirect
Initial Tags
php, header, redirect
Initial Language
PHP