I have a login page and a main page. On the login page I am asking for Username and Password and on the main page I m displaying some values from the database. Problem is with the logout function. I am doing it like this:

**login.php Page**

```
<?php
session_start();

if (isset($_POST['submit'])) {
    //log in code and to go to main.php
}

if (isset($_REQUEST['logstate'])) {
    session_destroy();
}

?>

```

**main.php Page**

```
<a href="login.php?logstate=logout"><img src="logout.png" id="Logout"></a>

```

Now when I click on the log out image, it ends the session, but returns me with the URL: `xxxxx.com/login.php?logstate=logout`

I want it to return me the url: `xxxxx.com/login.php`