title: PHP redirect to page on form submit based on select
body: <p>I am trying to get PHP to read my select options as variables and then echo out a particular page based on the users choice. </p>
  
  <p>The login system is functional but only logs me into one page. </p>
  
  <pre><code>&lt;form action="login.php" method="POST"&gt;
      &lt;table cellspacing="10"&gt;
          &lt;tr&gt;
              &lt;td&gt;Email: &lt;/td&gt;
              &lt;td&gt;&lt;input type='text' name='email'/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Password: &lt;/td&gt;
              &lt;td&gt;&lt;input type='password' name='password'/&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Event: &lt;/td&gt;
              &lt;td&gt;
                  &lt;select name="event"&gt;
                      &lt;option&gt;&lt;?php echo $title?&gt;&lt;/option&gt;
                      &lt;option&gt;&lt;?php echo $title2?&gt;&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;br /&gt;
      &lt;button class="button" type='submit' name='Submit' value='Submit' /&gt;Login&lt;/button&gt; 
  &lt;/form&gt;
  
  &lt;?php
  
       if (!empty($email) &amp;&amp; !empty($password)) {
  
                  $pdo = getPdo();
  
                  $statement = $pdo-&gt;prepare('SELECT * FROM awdawda WHERE email=:email;');
  
                  $statement-&gt;bindParam(':email', $email);
  
                  $statement-&gt;execute();
  
                  $data = $statement-&gt;fetch();
  
                  $pdo = null;
  
                  if (!empty($data)) {
                      $dbemail = $data['email'];
                      $dbpassword = $data['password'];
                      $dbfullname = $data['fullname'];
  
                      if ($password == $dbpassword) {
                          $_SESSION['fullname'] = $dbfullname;
                          $_SESSION['email'] = $email;
                          $_SESSION['password'] = $password;
  
                          if ($_POST['event']) {
                              $event1=$title;
                              echo '&lt;script type="text/javascript"&gt;window.location = "http://awda/adwa/awd1.php" &lt;/script&gt;';
                          }
  
                          if ($_POST['event']) {
                              $event2=$title2;
                              echo '&lt;script type="text/javascript"&gt;window.location = "http://awdaw/awda/adwa.php" &lt;/script&gt;';
                          }
  
                      }
  
                      echo '&lt;div style="padding: 10px;"&gt;Login Failed: Password Incorrect&lt;/div&gt;';
                  }
  
                  echo '&lt;div style="padding: 10px;"&gt;User not found&lt;/div&gt;';
              }
  
  ?&gt;
  </code></pre>
  
  <p>That is the code I am using to login with. I left out what was above it since it all works fine right now. </p>