Using GET Method to Maintain Variables After Logging In
<p>I am using a login system.  When I navigate to comments/index.php without logging in, some variables get passed along using the GET method just fine.  Then, if I log in while I am on this page, these variables disappear.  The variables that disappear are $submission, $submissionid, and $url.  </p>

<p>I thought I could use the GET method to keep them live after logging in by appending <code>?submission='.$submission.'&amp;submissionid='.$submissionid.'&amp;url='.$url.'</code> to the URL of the login form action as seen below.  But the variables still disappeared after I made this addition.</p>

<p>The relevant code I am trying to use is below.</p>

<p>Any idea what I can do to make it do what I want?</p>

<p>Thanks in advance,</p>

<p>John</p>

<p>In comments/index.php:</p>

<pre><code> require_once "header.php"; 

 include "login.php";

 include "comments.php";
</code></pre>

<p>In login.php:</p>

<pre><code>if (!isLoggedIn())
{

    if (isset($_POST['cmdlogin']))
    {

        if (checkLogin($_POST['username'], $_POST['password']))
        {
            show_userbox();
        } else
        {
            echo "Incorrect Login information !";
            show_loginform();
        }
    } else
    {

        show_loginform();
    }

} else
{

    show_userbox();
}
</code></pre>

<p>In comments.php:</p>

<pre><code>$url = mysql_real_escape_string($_GET['url']);
echo '&lt;div class="subcommenttitle"&gt;&lt;a href="http://www.'.$url.'"&gt;'.$submission.'&lt;/a&gt;&lt;/div&gt;';




$submission = mysql_real_escape_string($_GET['submission']);
$submissionid = mysql_real_escape_string($_GET['submissionid']);
</code></pre>

<p>The login function:</p>

<pre><code>function show_loginform($disabled = false)
{

    echo '&lt;form name="login-form" id="login-form" method="post" action="./index.php?submission='.$submission.'&amp;submissionid='.$submissionid.'&amp;url='.$url.'"&gt; 

    &lt;div class="usernameformtext"&gt;&lt;label title="Username"&gt;Username: &lt;/label&gt;&lt;/div&gt; 
    &lt;div class="usernameformfield"&gt;&lt;input tabindex="1" accesskey="u" name="username" type="text" maxlength="30" id="username" /&gt;&lt;/div&gt; 


    &lt;div class="passwordformtext"&gt;&lt;label title="Password"&gt;Password: &lt;/label&gt;&lt;/div&gt; 
    &lt;div class="passwordformfield"&gt;&lt;input tabindex="2" accesskey="p" name="password" type="password" maxlength="15" id="password" /&gt;&lt;/div&gt; 


    &lt;div class="registertext"&gt;&lt;a href="http://www...com/sandbox/register.php" title="Register"&gt;Register&lt;/a&gt;&lt;/div&gt; 
    &lt;div class="lostpasswordtext"&gt;&lt;a href="http://www...com/sandbox/lostpassword.php" title="Lost Password"&gt;Lost password?&lt;/a&gt;&lt;/div&gt; 

  &lt;p class="loginbutton"&gt;&lt;input tabindex="3" accesskey="l" type="submit" name="cmdlogin" value="Login" ';
    if ($disabled == true)
    {
        echo 'disabled="disabled"';
    }
    echo ' /&gt;&lt;/p&gt;&lt;/form&gt;';


}
</code></pre>
