WordPress.org

Support

Support » Plugins and Hacks » Pass Variable From Page to Page

Pass Variable From Page to Page

  • Hi All,

    I already know how to pass a variable to a single page or post. However, I do not know how to pass the variable to a different page or post. For example, if the user goes to this URL:

    http://www.mywordpressblog.com/post1/?myvariable=testing

    Then, in post1 I can call on myvariable. However, if the user then clicks on another post or page, I do not know how to pass myvariable to the outgoing page/post. I tried using a session_id as described here:

    http://largeaffiliate.com/cool-tip-pass-variables-from-page-to-page-in-wordpress/

    but myvariable is not stored and not passed from page to page or post to post. I even tried putting the following code in my theme’s header file.

    <br />
    session_start();<br />
    if(isset($_SESSION['myvariable']))<br />
    $_SESSION['myvariable'] = $_SESSION['myvariable'];<br />
    else<br />
    $_SESSION['myvariable'] = $_GET['myvariable'];<br />

    Can someone please help me. I been trying to get this to work for awhile.

  • The topic ‘Pass Variable From Page to Page’ is closed to new replies.
Skip to toolbar