Results 1 to 3 of 3

Thread: Using $_SESSION variables in Templates

  1. #1
    Join Date
    May 2009
    Posts
    5

    Default Using $_SESSION variables in Templates

    I have been using FormMail for several years to send Order details to the site owner with an Autorespond to the user.

    Some of the fields in the templates just used the normal "$fieldname" syntax, but for others, in particular the contents of the Shopping Cart I used php $_SESSION variables to show the details. (I probably could have workd around this, except for the Cart details where there didn't seem to be any practical alternative).

    In any event, this all worked fine until a couple of days ago when my host made changes to use suPHP and to change the php version to 5.3.10, and my templates can no longer use the Session variables. As a result, the emails sent are, for practical purposes, useless. As I said, I think I can work around most of the fields, but I have no idea how to do this with the Cart details, which of course have an unknown number of items and 6 fields for each item, so I'm stuck.

    Does anyone know why this problem might have occurred and what the solution might be? It is clearly connected to the changes made on the server, but I can't find anything relating to this in this Forum or in the online PHP documentation.

    I have upgraded FormMail to 8.35 (My version was previously 8.14), but this changed nothing. I use Sessions extensively throughout the site and everything else seems to be working perfectly as before.

    Thanks,

    Iain Young

  2. #2
    Join Date
    Mar 2004
    Posts
    2,224

    Default Re: Using $_SESSION variables in Templates

    formmail reads the template files and then fills in the details

    when u use TEMPLATEURL for dynamic templates (like u must have) it puts the session ID in the URL

    ur host must have changed the php config

    in particular: use_only_cookies

    if u can change ur setting (use .htaccess or a local copy of php.ini?) it should fix the problem

    or maybe add this to the top of ur template:
    PHP Code:
    ini_set('session.use_only_cookies',0); 

  3. #3
    Join Date
    May 2009
    Posts
    5

    Default Re: Using $_SESSION variables in Templates

    Quote Originally Posted by crabtree View Post
    formmail reads the template files and then fills in the details

    when u use TEMPLATEURL for dynamic templates (like u must have) it puts the session ID in the URL

    ur host must have changed the php config

    in particular: use_only_cookies

    if u can change ur setting (use .htaccess or a local copy of php.ini?) it should fix the problem

    or maybe add this to the top of ur template:
    PHP Code:
    ini_set('session.use_only_cookies',0); 
    I tried your final suggestion and everything is now fine.

    I really appreciate your help in this matter. I knew my host must have changed something, but there is no way I would have found the solution.
    Thank you very much.

    Regards,

    Iain Young

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Capturing URL variables
    By dennisouellette in forum Community Support
    Replies: 1
    Last Post: 26-Feb-2009, 03:26 PM
  2. Advanced Error Handling, Custom Templates & Dreamweaver Templates
    By wiggley_knee in forum Community Support
    Replies: 4
    Last Post: 15-Jul-2008, 11:23 AM
  3. Adding Variables
    By Barnsabe in forum Community Support
    Replies: 2
    Last Post: 11-May-2007, 06:17 PM
  4. Replies: 2
    Last Post: 19-Apr-2006, 02:46 AM
  5. Variables Not Available In PHP
    By knelson in forum FormMail Subscription Support
    Replies: 2
    Last Post: 10-Nov-2005, 08:14 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •