jalea148 Posted July 3, 2007 Share Posted July 3, 2007 There are 3 pages: A, B, C; B resides on another server. With Session variables I can share form data on A with C when I post directly to C. However, if I post to B and redirect to C, sharing doesn’t seem to work with C. If this is possible, what are the guidelines [i.e. what needs to be added beyond what was necessary when the form in A posted directly to C]? Quote Link to comment Share on other sites More sharing options...
skali Posted July 3, 2007 Share Posted July 3, 2007 Are you using session_start() on B? If yes, are you saving your $_POST data into $_SESSION that can be used on C? You need to session_start() on every page where you want to access session data. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 3, 2007 Share Posted July 3, 2007 B resides on another server. Just an FYI....Sessions do not work across domains. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 3, 2007 Share Posted July 3, 2007 Try using cookies instead of sessions. Quote Link to comment Share on other sites More sharing options...
jalea148 Posted July 3, 2007 Author Share Posted July 3, 2007 B is not my page - it belongs to a service and I doubt if there is a session_start(). The redirect to C is on the form in page A. Quote Link to comment Share on other sites More sharing options...
jalea148 Posted July 3, 2007 Author Share Posted July 3, 2007 I'll try cookies - thanx. Quote Link to comment Share on other sites More sharing options...
jalea148 Posted July 3, 2007 Author Share Posted July 3, 2007 tried cookies - no luck. If the post goes directly to C from A, POST, session variables and cookies all work - the form data from A appears in the form on C. However, if the form in A posts to a different form [off the server] and gets to the form on C via Redirect, no data appears in C's form. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 3, 2007 Share Posted July 3, 2007 You either have to post the data using www.php.net/cURL OR you have to attach the data via GET or POST (post with curl) as cookies and sessions will not work across domains as someone else pointed out. Quote Link to comment Share on other sites More sharing options...
jalea148 Posted July 3, 2007 Author Share Posted July 3, 2007 Both page A and Page C are in the same directory on the server. Aren't they in the same domain? Quote Link to comment Share on other sites More sharing options...
True`Logic Posted July 3, 2007 Share Posted July 3, 2007 in your config or in php.ini (doesnt really matter), find the auto_prepend_file part (or just put it in the config under where you added the php file types) and add auto_prepend_file /data/sess.php and in ~/data/sess.php have the following <?php session_start(); ?> that's a lazy way to do it, and also saves space Quote Link to comment Share on other sites More sharing options...
per1os Posted July 4, 2007 Share Posted July 4, 2007 Both page A and Page C are in the same directory on the server. Aren't they in the same domain? Yea, someone was just stating that you were trying to get it to a different domain, my bad. Quote Link to comment Share on other sites More sharing options...
jalea148 Posted July 4, 2007 Author Share Posted July 4, 2007 I don't control the server with pages A or C where they reside. So, it may be difficult to get at the auto_prepend_file, config or php.ini files. Page B is on still another server. Rather than using a redirect to bring up page C, would it be possible for the action in Page A to post to both page B and page C [using only 1 submit button]? Page B is never accessed by the user who should only see page C. [b is a service that requires it incoming data from a POST??? There would not be a problem if they accepted email.] Validation is required on page A. This would solve the cookie problem. BTW, I can't trick it by posting directly to Page C - it already posts to formmail.php and redirects to thank you. Quote Link to comment Share on other sites More sharing options...
trq Posted July 4, 2007 Share Posted July 4, 2007 would it be possible for the action in Page A to post to both page B and page C [using only 1 submit button]? As has previously been suggested, take a look at curl. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.