title: Removing URL parameters to reset PHP variable?
body: <p>I have a personal website where I want to showcase some downloads I've made. Each download has a description and download link, however I don't want to create an individual page for each item (as in 'item1.php', 'item2.php', etc.) because the format is pretty much "standard." So, I put all the text in a XML file and then use PHP to parse it.</p>
  
  <p>Here's what my XML looks like:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;txtdb&gt;
    &lt;txt name="index"&gt;
      &lt;str key="title"&gt;Index&lt;/key&gt;
      &lt;str key="metadescription"&gt;Personal site&lt;/key&gt;
  
      &lt;str key="navigation"&gt;Navigation&lt;/key&gt;
  
      &lt;str key="description"&gt;&lt;!CDATA[[&lt;h2&gt;Description&lt;/h2&gt;]]&gt;&lt;/key&gt;
      &lt;str key="download"&gt;&lt;!CDATA[[&lt;h2&gt;Download&lt;/h2&gt;]]&gt;&lt;/key&gt;
    &lt;/txt&gt;
    &lt;txt name="item1"&gt;
      &lt;str key="title"&gt;Item 1&lt;/key&gt;
      &lt;str key="metadescription"&gt;Item 1 is awesome, get it now!&lt;/key&gt;
  
      &lt;str key="description"&gt;&lt;!CDATA[[&lt;p&gt;Item 1 is an incredible item that you must get right away!&lt;/p&gt;]]&gt;&lt;/key&gt;
      &lt;str key="download"&gt;&lt;!CDATA[[&lt;a href="http://dropbox.com"&gt;Here&lt;/a&gt;]]&gt;&lt;/key&gt;
    &lt;/txt&gt;
    &lt;!-- ... --&gt;
  &lt;/txtdb&gt;
  </code></pre>
  
  <p>And here's my index.php:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  $current = 'index';
  
  class TextDatabase()
  {
    private $_xdb;
    private $_name;
  
    public function __construct($xdt)
    {
      $this-&gt;_xdb = simplexml_load_file('./incl/txt.xml');
      $this-&gt;_name = $xdt;
    }
  
    public function getString($key, $name = null)
    {
      if (empty($name))
      {
        $name = $this-&gt;_name;
      }
      $str = $this-&gt;_xdb-&gt;xpath(sprintf("//txt[@name='%s']/str[@key='%s']", $name, $key));
      return empty($str[0]) ? null : (string) html_entity_decode($str[0]);
    }
  }
  
  session_start();
  if (isSet($_GET['name']))
  {
    $current = $_GET['name'];
    $_SESSION['name'] = $current;
  }
  else if (isSet($_SESSION['name']))
  {
    $current = $_SESSION['name'];
  }
  else
  {
    $current = 'index';
  }
  
  $TxtDb = new TextDatabase($current);
  
  include_once('incl/header.php');
  include_once('incl/sidebar.left.php');
  
  if ($current == 'index'):?&gt;
  &lt;h2&gt;&lt;?php echo $TxtDb-&gt;getString('navigation'); ?&gt;&lt;/h2&gt;
  &lt;ul&gt;
    &lt;li&gt;&lt;a href="index.php?name=item1"&gt;&lt;?php echo $TxtDb-&gt;getString('title','item1'); ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="index.php?name=item2"&gt;&lt;?php echo $TxtDb-&gt;getString('title','item2'); ?&gt;&lt;/a&gt;&lt;/li&gt;
    &lt;!-- more items --&gt;
  &lt;/ul&gt;
  &lt;?php else: ?&gt;
  &lt;h2&gt;&lt;?php echo $TxtDb-&gt;getString('description','index'); ?&gt;&lt;/h2&gt;
  &lt;article&gt;&lt;?php echo $TxtDb-&gt;getString('description'); ?&gt;&lt;/article&gt;
  &lt;h2&gt;&lt;?php echo $TxtDb-&gt;getString('download','index'); ?&gt;&lt;/h2&gt;
  &lt;article&gt;&lt;?php echo $TxtDb-&gt;getString('download'); ?&gt;&lt;/article&gt;
  &lt;?php endif;
  
  include_once('incl/sidebar.right.php');
  include_once('incl/footer.php');
  ?&gt;
  </code></pre>
  
  <p>At the moment, it works. If I go to 'index.php' I see a list of my items. Then, when I click one of them I'm sent to 'index.php?name=item<em>n</em>.' However, I have one link in the header that points to 'index.php' and when I click it, the page reloads, but I'm not back to the index. In order to return to the index I would have to change the link to point to 'index.php?name=index', but I don't like this. Is there a way to make "index.php" (without parameters) return to the index instead of the current item (which I believe is stored in the PHP session)?</p>
  
  <p>This is my first time working with PHP (I like C# better), so sorry if it's a dumb question. Thanks for any help.</p>