in reply to Passing values between Apache SSIs

You can't pass values from the first to the second script, because the first doesn't ever call the second script.

Your best chance is to ensure that the user already has a cookie, then set up the session in session.cgi, store it in the DB, and retrieve it in cart.cgi. That probably defeats the purpose of the separation of the two scripts.

So instead of using two SSIs, call a dispatch script that calls both scripts and passes the values from the first to the second.

Replies are listed 'Best First'.
Re^2: Passing values between Apache SSIs
by atemon (Chaplain) on Jun 02, 2008 at 09:46 UTC

    Hi,

    Thanks for your help. But I am using more SSIs in the HTML, where each SSIs are separated by loads of HTML. So I cant call them from a despatch script. Also, I have more HTMLs which have session.cgi, along with SSIs other than cart.cgi. I kept them together for demonstration purpose only.
    I will try setting cookies from session.cgi

    Cheers !

    --VC
    Gods Own Country...

      I will try setting cookies from session.cgi
      That won't work, because there are no new HTTP requests between the call to session.cgi and the other scripts. You can only access the session in all those scripts if the user already has a cookie.

      Your application sounds if it's hight time to switch to a decent template system (and perhaps a MVC framework) instead of HTML pages intermingled with SSI. I built pages like that (HTML + lots of SSI) in the past, and I found that the complexity of passing information around outweighs the seemingly simplicity that it offers at first.

      Your question demonstrates that HTML+SSI isn't very flexible when used like this, and it's really painful to extend and scale inflexible systems.