Welcome Guest, Not a member yet? Register   Sign In
Send message to a page.
#1

[eluser]WebbHelp[/eluser]
Hi!

I got a form on my page, and if the user success and follow the form rules; Then, the user are "beeing"(is it beeing?) redirected back to the menu again.
I want to tell the user that he successed, and I tried to send a segment, with the user, but, it didn't worked, maybe becaus it was + and swedish characters in like åäö.
And I don't want to change the preg_match(); thing in routers.php or something hehe Tongue

Is there any other way to send the message with the user and write it out on the page?
Like a session or something, what should i do?

Thanks //Webbhelp



Other questions =):
http://ellislab.com/forums/viewthread/137923/
http://ellislab.com/forums/viewthread/137931
#2

[eluser]markup2go[/eluser]
See the section about Flashdata on the Session library page of the user guide.
#3

[eluser]WebbHelp[/eluser]
That sounds nice!

So I only got the flashdata variables until I change page, for exmaple if I use redirect to another page, I can use the flashdata variables there but if I use redirect again, they are lost?
If I want them more, shall I use codeigniters normal sessions? Tongue
#4

[eluser]frist44[/eluser]
What more would you tell them? I would imagine that any information you wanted to make persistent beyond one page would deserve to be in the session.
#5

[eluser]markup2go[/eluser]
If you need to automatically clear the session variable after a request is sent, then use flashdata. If this is the case and you need to preserve this variable for another request, look at the keep_flashdata() function on the same page I referenced in my first response.
#6

[eluser]WebbHelp[/eluser]
Yeah, sorry my bad. I forgot to say if it not is message. Sorry I write my question here:

Shy should I use codeigniter sessions insteadstead of pvp sessions.
I don't really get it?

Thanks Smile
#7

[eluser]frist44[/eluser]
It's a different implementation of sessions. PHP stores them on the server, and codeigniter ("out of the box") uses cookies. If you have anything important like passwords or other stuff, i would suggest using PHP sessions. There are some add-in libraries floating around that will extend/replace codeigniter's session library to use PHP sessions instead for those situations.
#8

[eluser]CtheB[/eluser]
You don't need session's for this

If you redirect them to http://www.yourdomain.com/index.php/a/b/succes

In the method you will have the parameter of succes and here you can set the data to display like this:

Code:
<?php
class A extends Controller {

    function A()
    {
         parent::Controller();
    }

    function b($succes = FALSE)
    {
          if($succes == 'succes')
          {
              $data['succes'] = "You have succesfully filled out the form";
          }
          else
          {
              $data['succes'] = "";
          }

          $this->load->view('c', $data);
    }
}
?>
#9

[eluser]WebbHelp[/eluser]
Yes, thanks that is a good solution, what is best session or that one?

One more question:
I read session user guide page again byt if i use database, is there any cookie then?
and why shall i use codeigniter's sessions? And not normal php.
I mean to use php sessions seems to be easier, right?

Thanks //webbhelp

Btw: where do i write session start with codeigniter? Which files.
Thanks again
#10

[eluser]CtheB[/eluser]
You should only use sessions with forms in your application.
You use them inside your controller.




Theme © iAndrew 2016 - Forum software by © MyBB