Frames, Sessions and $_POST

From: Date: Wed, 28 Apr 2004 21:08:15 +0000
Subject: Frames, Sessions and $_POST
Groups: php.general 
Request: Send a blank email to php-general+get-184903@lists.php.net to get a copy of this message
Why doesn't the session array get loaded when session id is passed by way of $_POST ? I am working in a left/main frameset paradigm where an <a> click in the left frame does two things: 1. posts to main (using javascript) 2. links to left In this example, index.php is the frameset. When initially display, both left and main frames have same session id. When link in left side is clicked, the session id is posted to main.php (and passed in url to left.php), but the main frame output shows that the session id is different than the one posted to it... meaning the session variables set by left.php and index.php are unavailable to main.php. Is there a way to force session functions to obtain session id to be loaded from get *or* post ? Do I have to murk around in the source and recompile ? index.php ----- <? session_start(); $_SESSION['info1'] = 'assigned by index.php'; ?> <html> <frameset cols="50%,*" rows="*" frameborder="1"> <frame src="left.php?<?=SID?>" name="left" frameborder="1"> <frame src="main.php?<?=SID?>" name="main" frameborder="1"> <noframes> <body bgcolor="#FFFFFF"> <p>Venue ticketing is more friendly with a <b>frames-capable</b> browser.</p> </body> </noframes> </frameset> </html> ----- main.php ----- <? session_start(); $_SESSION['bittid']='assigned by main.php'; ?> <html><head><title></title></head><body> <? echo "SID=".SID; print '<pre>'; print "Get\n"; print_r ($_GET); print "Post\n"; print_r ($_POST); print "Session\n"; print_r($_SESSION); print '</pre>'; ?> </body></html> ----- left.php ----- <? session_start(); ?> <html><head> <script type='text/javascript'> function post (x,y,z) { document.forms.XYZ.x.value = x document.forms.XYZ.y.value = y document.forms.XYZ.z.value = z document.forms.XYZ.submit () return true } </script> </head><body> <? echo "SID=".SID; print '<pre>'; print "Get\n"; print_r ($_GET); print "Post\n"; print_r ($_POST); print "Session\n"; print_r($_SESSION); print '</pre>'; ?> <form name=XYZ method=post target=main action='main.php'> <input type=hidden name=x value=.> <input type=hidden name=y value=.> <input type=hidden name=z value=.> <input type=hidden name=cesh value="<?=SID?>"> <!-- pass SID in POST --> </form> <!-- onclick method will submit post form and return true, which lets a perform its get --> <a onclick=post(1,2,3) href="?<?=SID?>&amp;a=1&amp;b=2&amp;c=3">Update left and right</A> </body></html> <? $_SESSION['tidbit']='assigned by left.php'; ?> ----- -- Richard A. DeVenezia

« previous php.general (#184903) next »