Welcome Guest, Not a member yet? Register   Sign In
Why can't I get my Flashdata for my next server request ?
#1

[eluser]DocFunky![/eluser]
Hello there,

I've been trying to figure out how to use those flashdatas.
I remember having difficulties last time, and this time again, it seems that I forget something.

So basically, I'm trying to set up a flasherror somewhere :
Code:
if(!$this->paypal_pro->APICallSuccessful($PayPalResult['ACK']))
  {
       $this->session->set_flashdata('flashError', array('Errors'=>$PayPalResult['ERRORS']));
   redirect('main/form');
  }


And in my main/form I got :

Code:
function Form()
{
// Process validation form
if ($this->form_validation->run() == FALSE)
            {
                //IF the validation process hasn't been run or there are validation errors
                $this->parser->parse('template/template', $data);

            }

and in that view, I'm trying to get that flashError :

Code:
<?php if($this->session->flashdata('flashError')):?>
  <div class='flashError'>
&lt;?php  
  $flashError=$this->session->flashdata('flashError');
  foreach( $flashError['Errors'] as $Error){
    echo $Error['L_SHORTMESSAGE'].' ('.$Error['L_ERRORCODE'].'):';
    echo '<br/>';
    echo $Error['L_LONGMESSAGE'];
   }
?&gt;
  </div>
&lt;?php endif?&gt;

I don't have anything in that variable, and when I try to var_dump it, It returns me false.

Can someone explain me how to use it despite the official documentation saying "will only be available for the next server request, and are then automatically cleared"

Thank you
#2

[eluser]CroNiX[/eluser]
You're setting regular session data but reading flashdata, try setting flashdata Smile
#3

[eluser]DocFunky![/eluser]
Hey hey thanks ... I made a typo in copying the code here :/
It was flashdata in my code, I edit the post.

So yeah now you have my code and I'd like to understand what's wrong with my process ?

Thank you




Theme © iAndrew 2016 - Forum software by © MyBB