Undefined index using more than one form
<p>Here's my problem:
I have two forms on the same page.
The first form works fine.
But whenever I click the submit button on the second form, I get two notices.
The first says "undefined index: email" which is referring to "$email = $_POST["email"];" in my coding.
The second says "undefined index: password" which is referring to "$password = $_POST["password"];" in my coding.
I do not want my 2nd form to be affected by all the "if statements" I created for the first form.  And I'm going to be creating more "if statements" for the 2nd form soon.
For example, when I hit the submit button on the second form, it's echoing "You need to enter an email and password" which is an error I only wanted applied to the first form.</p>

<p>So MY QUESTION IS: How can I get the forms to only be affected by a specific group of "if statements"?  Like in css coding you apply ids, but what would i do to the forms or "if statements" so the "if statements" only affect specific forms?</p>

<p>Here's the coding:</p>

<pre><code>&lt;form action="login.php" method="post"&gt;
        &lt;ul id="login"&gt;
            //login information
            &lt;li id="loginn"&gt;
                &lt;input type="submit" value="Log in"&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
&lt;/form&gt;

 &lt;form action="" method="post"&gt; 
        &lt;ul id="register"&gt;
                     //register info list items
                             &lt;li&gt;
                &lt;input type="submit" value="Sign up"&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
&lt;/form&gt;

&lt;?php

if (empty($_POST) === false) {
$email = $_POST["email"];
$password = $_POST["password"];

if (empty($email) === true || empty($password) === true) {
    $errors[] = "You need to enter an email and password.";
} else if (user_exists($email) === false) {
    $errors[] = "The email you entered is not in our records. Have you registered?";
} else if (user_active($email) === false) {
    $errors[] = "Go to your email, open the email we sent you,and activate your account.";
} else {$login = login($email, $password);
    if ($login === false) {
        $errors[] = "That email/password combination is incorrect.";
    } else {
        $_SESSION['users_id'] = $login;
        header('Location: homepage.php');
        exit();
    }
}

} 

if (empty($errors) === false) {

?&gt;

&lt;?php
echo output_errors($errors);
}
?&gt;
</code></pre>
