title: php get variables
body: <p>I'm new to php and need some help with "GET" variables.</p>
  
  <p>Here an extraction of my Code for index.php:</p>
  
  <pre><code>$array = array("section","view","sub","cat","point");
  $i = 0;
  $check = true;
  
  foreach ($_GET as $position =&gt; $wert) {
    if ($position != $array[$i]) {
      //if GET doesnt exist in the array set check to false
      $check = false;
      break;
    }
    $i++;
  }
  
  //if GET variables exists
  if ($check == true) {
    if (isset($_GET['section'], $_GET['view'], $_GET['sub'], $_GET['cat'], $_GET['point'], $point[$_GET['point']])) {
      $path = $path_dynamic.$_GET['section']."/".$_GET['view']."/".$_GET['sub']."/".$_GET['cat']."/".$point[$_GET['point']];
      check($path);
    } else if (isset($_GET['section'], $_GET['view'], $_GET['sub'], $_GET['cat'], $cat[$_GET['cat']])) {
      $path = $path_dynamic.$_GET['section']."/".$_GET['view']."/".$_GET['sub']."/".$cat[$_GET['cat']];
      check($path);
    } else if (isset($_GET['section'], $_GET['view'], $_GET['sub'], $sub[$_GET['sub']])) {
      $path = $path_dynamic.$_GET['section']."/".$_GET['view']."/".$sub[$_GET['sub']];
      check($path);
    } else if (isset($_GET['section'], $_GET['view'], $view[$_GET['view']])) {
      $path = $path_dynamic.$_GET['section']."/".$view[$_GET['view']];
      check($path);
    } else if (isset($_GET['section'], $section[$_GET['section']])) {
      $path = $path_dynamic.$section[$_GET['section']];
      check($path);
      //if section isn't set
    } else if (!isset($_GET['section'])) {
      include ($path_dynamic.$section['news']);
    }
  } else {
    echo "GET doesn't exist";
    include ($path_static.$section['error']);
  }
  
  //check if GET exists
  function check($path) {
    if (file_exists($path)) {
      echo "File imported&lt;br /&gt;";
      include ($path);
    } else {
      echo "GET set correct but file doens't exist";
      include ('include/static/fehler.html');
    }
  }
  </code></pre>
  
  <p>Example of section.php (view, sub, cat and point is the same):</p>
  
  <pre><code>$section = array();
  $section['error'] = 'fehler.html';
  </code></pre>
  
  <p>My problem is that if i set this link:</p>
  
  <pre><code>index.php?section=verein&amp;view=vorstande
  </code></pre>
  
  <p>"vorstande" doesn't exist in my view array. So the code checks for the section "verein" and include "verein". But it should give an error.</p>
  
  <p>So it seems that this code</p>
  
  <pre><code> } else if (isset($_GET['section'], $_GET['view'], $view[$_GET['view']])) {
  </code></pre>
  
  <p>is ignored and it jumps to</p>
  
  <pre><code>  } else if (isset($_GET['section'], $section[$_GET['section']])) {
  </code></pre>
  
  <p>Also if I change my url to this:</p>
  
  <pre><code>index.php?section=vereine&amp;view=vorstande
  </code></pre>
  
  <p>nothing happens. I even don't know where the code is right now.</p>
  
  <p>But if I change the url to this:</p>
  
  <pre><code>index.php?section=vereine&amp;view=vorstand
  </code></pre>
  
  <p>everything works fine.</p>
  
  <p>So "verein" and "vorstand" is defined by me. "vereine" and "vorstande" doens't exist.</p>
  
  <p>Any suggestions? Sry for comments in german. The echo only gives me a hint where the code is right now!</p>
  
  <p><a href="http://www.jkm.gtaberlin.de/HP/" rel="nofollow">Link</a> to my HP:</p>
  
  <p>Edit: 
  - translated comments for better conversation
  - deleted all "$...[$_GET['...']]" structures to show the error I will get instead.</p>