CodeIgniter Forums

Full Version: iframe not seeing session variable assigned in popup window
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]spider pig[/eluser]
Hi

I am writing the software to add an option to a product (i.e. colour range). The user selects a option in a popup window and there is a iframe that contains the list of selected options. The following script is run when the option is selected in the popup window:

Code:
function modify() {
    $prodOptions = $this->session->userdata('prodOptions');
    $prodOptions[] = $this->uri->segment(6, 0);
    $this->session->set_userdata('prodOptions', $prodOptions);
    $row->al_main_content = '<div class="message"><h4>The option has been added to the product.</h4></div>'.LF
            .'[removed]'.LF.'opener.frames["OptionsFrame"].location.reload();'.LF.'[removed]'.LF;
    $this->load->view('product/options_popup', $row);
}

The iframe is reloaded ok, but the session variable does not contain the value set in the popup window.

Here is the code for the iframe:
Code:
function iframe() {
    if ($this->session->userdata('prodOptions') == NULL or $this->session->userdata('prodOptions') == array()) {
        $row->al_main_content = '<h5>No product options have been selected.</h5>'.LF;
        $this->load->view('product/iframe', $row);
        return;
    }
    $row->al_main_content = $this->products_model->options_list();
    $this->load->view('product/iframe', $row);
}

The session library is auto loaded.

Any ideas?

El Forum

[eluser]spider pig[/eluser]
DOOH! I had cookies switched off in my web browser. Another seniors moment Smile