redranger8487 Posted May 20, 2009 Share Posted May 20, 2009 Hi Everyone..I am trying to pass a variable from a master page to another page, which is then called into an iframe on the master page. Its for a slideshow. I need to pass the URL of the Master page to the client(slideshow) page, so that it can figure out which folder it has to access in order to display the images. I have tried SESSIONS & COOKIES, but seems not to hold the values in it. The Session(and cookie) variables are holding the value on the master page(verified by "echo $_SESSION['variable'];" on the master page), but is NULL on the client page. I do not know why. Please suggest a method to pass a variable from the Master to client page (both are PHP pages). I have been held up at this roadblock for over 2 weeks. Any help is greatly appreciated..Thanks a lot!! Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/ Share on other sites More sharing options...
BobcatM Posted May 20, 2009 Share Posted May 20, 2009 Are the Master page and Client page on the same server? Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838389 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 Are the Master page and Client page on the same server? Ā :)Thanks for responding..yes..they are on the same server and folder.. Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838405 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 passing the variable via the cookie should of worked have you not got any code that we can see ? Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838406 Share on other sites More sharing options...
POG1 Posted May 20, 2009 Share Posted May 20, 2009 If its in a frame why not just use GET? Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838408 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 passing the variable via the cookie should of worked have you not got any code that we can see ? Ā Hi Madspof, Ā Here is the cookie code on the master page(Manufacturer.php): <?php $value = 'MasterURL'; setcookie("TestCookie", $value); ?> Ā Here is the cookie recieve code in client page(custom.php): Ā <?php error_reporting(E_ALL); echo $_COOKIE["TestCookie"]; ?> Ā The error I am getting is as follows: Ā *********** Warning: Cannot modify header information - headers already sent by (output started at /homepages/11/d230709522/htdocs/SITETEST/index.php:4) in /homepages/11/d230709522/htdocs/SITETEST/manufacturer.php on line 229 *********** Ā I tried the SESSION method too..its the same sad story.. :-\ ... Ā Ā Ā Ā Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838418 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 If its in a frame why not just use GET? Ā HI POG1, Thanks for responding. I am trying to implement a slideshow that automatically starts on page load. The (dynamic)URL of the master page has to be passed to the client page automatically, at page load. The client page would then load the appropriate image folder, based on that URL. Please let me know if you how to acheive that using GET/POST. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838423 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 try placing this before the echo ob_start(); Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838427 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 try placing this before the echo ob_start(); Ā Hi Madspof..I put that code in before "echo $_COOKIE"....its the same error.. "...headers already sent by..."Ā Ā Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838430 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 what on line 229? Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838431 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 what on line 229? 228:Ā $value = 'MasterURL'; 229:Ā setcookie("TestCookie", $value); 230:Ā ?> Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838438 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 erm try putting ob_end_flush(); before the ob_start and then one after the echo Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838442 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 erm try putting ob_end_flush(); before the ob_start and then one after the echo Ā Hi Madspof...there is a new notice coming up: Notice: ob_end_flush() [ref.outcontrol]: failed to delete and flush buffer. No buffer to delete or flush. in /homepages/11/d230709522/htdocs/SITETEST/slideshow/custom.php on line 10 Ā other than that..nothing else has changed. Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838444 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 can you post the whole code please like everthing im realy tired and would apprecaite it Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838448 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 can you post the whole code please like everthing im realy tired and would apprecaite it Ā Hi madspof.. Ā I just emailed you both the files..Thanks for your effort!! Ā Ā Ā Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838454 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 email you back if that does not work i think we should try the get method as there is no reason why that should work i hope lol Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838458 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 email you back if that does not work i think we should try the get method as there is no reason why that should work i hope lol Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838463 Share on other sites More sharing options...
madspof Posted May 20, 2009 Share Posted May 20, 2009 i guess it worked ? :-) Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838464 Share on other sites More sharing options...
redranger8487 Posted May 20, 2009 Author Share Posted May 20, 2009 i guess it worked ? :-) Ā I was waiting for your email..I do not know how to use the GET method to get this done. The URL has to pass to the custom.php file as soon as the manufacturer page loads. Im not aware of a way to pass the URL automatically to the custom.php file, on page load. Please let me know if you have an idea.Thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838472 Share on other sites More sharing options...
madspof Posted May 21, 2009 Share Posted May 21, 2009 I re sent the email this morning not sure if it will help or not if you dont get it again try your junk email folder anyway see you soon. Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-838770 Share on other sites More sharing options...
madspof Posted May 21, 2009 Share Posted May 21, 2009 Ino what was wrong with it, i explain in the latest email i sent you anyway should work now :-) mark as solvd if it does work thanksĀ Quote Link to comment https://forums.phpfreaks.com/topic/158966-passing-variables-between-php-pages/#findComment-839061 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.