Jump to content

Passing variables between PHP pages


redranger8487

Recommended Posts

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!!

Link to comment
Share on other sites

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.. :-\ ...

Ā 

Ā 

Ā 

Ā 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.