We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7575
    • 85 Posts
    Hi,

    I am well on my way with creating a modx site that shows results of an event database.
    I have working categories and a search form,
    Now I would like to keep the variables of the search form in the $_session variables.
    that way, when browsing throug category A with certain search settings (ex country of the event), they will be remembered even if you go to another category.

    So what I need to do is :
    1 set the country variable from my form in the current session when submitting the form.
    2 get the country variable from the current session.

    I am thinking that shouldn't be too difficult but I can't seem to get started,
    as I never worked with sessions before, any help would be great.

    djemmers
      www.tornooi.net online database for (sport) events in dutch.
      To be redesigned, rewritten to modx with multiple languages...
      ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      To set it..

      $_SESSION['searchdata'] = $arrayOfValues;


      And to get it..
      $arrayOfValues = $_SESSION['searchdata'];


      MODX will then take care of storing the session and retrieving it again based on the PHPSESSID cookie. smiley
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 7575
        • 85 Posts
        Quote from: markh at Dec 16, 2012, 07:19 AM
        To set it..

        $_SESSION['searchdata'] = $arrayOfValues;


        And to get it..
        $arrayOfValues = $_SESSION['searchdata'];


        MODX will then take care of storing the session and retrieving it again based on the PHPSESSID cookie. smiley

        that's great, and it looks easy!
        tnx
          www.tornooi.net online database for (sport) events in dutch.
          To be redesigned, rewritten to modx with multiple languages...
          ANY help appreciated, I cannot offer money but I can offer free advertising on the site. just message me.