ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Session Variable on post

June 09, 2009 6:58am

Subscribe [1]
  • #1 / Jun 09, 2009 6:58am

    Nate Iler

    29 posts

    I’m trying to set a php session variable on post.  When the action is left blank, the session is set, but if I try to redirect to a thank-you page the session isn’t set.  I’m not well versed with setting session variables so I don’t know if it’s an EE limitation or something I’m doing wrong.  I’ve tried both parsing on input and output.

    This works:

    <?
      session_start();
      $_SESSION['name'] = $_POST['name'];
      echo "name = ". $_SESSION['name']; 
    ?>
    
    <form method="post" action="">
      <input type="text" name="name" />
      <input type="submit" value="Submit" />
    </form>

    This doesn’t:

    <?
      session_start();
      $_SESSION['name'] = $_POST['name'];
      echo "name = ". $_SESSION['name']; 
    ?>
    
    <form method="post" action="http://site.com/thank-you">
      <input type="text" name="name" />
      <input type="submit" value="Submit" />
    </form>

    Thanks in advance.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases