Trying to create login I'm new to PHP and web development in general. Is this a good coding style for me as a beginner?  I don't care about password hashing.  I use MD5 which is, as far as I know, not a good encryption method, and I'm trying to create just the login for now.

connection.php:

&lt;?php   

try {
    $pdo = new PDO("mysql:host=localhost;dbname=akar","akar","raparen");
} catch (PDOException $e) {
    echo $e-&gt;getMessage();
}
?&gt;


index.php: 

&lt;?php 
session_start();
include "connection.php";

if(isset($_SESSION['logged_in']) == true){
    //Redirect the user to members
    header("Location: member.php");
    exit();

} else {
    ?&gt;

    &lt;?php 
}
    if(isset($_POST['username']) &amp;&amp; isset($_POST['password'])) {
        $username = $_POST['username'];
        $password = md5($_POST['password']);

        if(empty($username) or empty($password)) {
            //Display Errors
            $error = "All fields are required!";

        } else {
            //Verify the user
            $sql = "SELECT * FROM `users` WHERE user_name = ? AND user_password = ?";
            $query = $pdo-&gt;prepare($sql);
            $query-&gt;bindValue(1,$username);
            $query-&gt;bindValue(2,$password);
            $query-&gt;execute();

            if ($query-&gt;rowCount() &gt; 0) {
                //User details right
                $_SESSION['logged_in'] = true;
                header("Location: member.php");
            } else {
                //User details wrong
                $error = "Wrong username or password";
            }
        }
    }

?&gt;

&lt;?php if (isset($error))  { ?&gt;
 &lt;small style="color:#aa0000; font-weight:bold;"&gt;
    &lt;?php echo $error; ?&gt;
 &lt;/small&gt;
&lt;?php } ?&gt;


member.php:

&lt;?php 
session_start();

if($_SESSION['logged_in']) {
    echo "You're logged in";
} else {
    header("Location: index.php");
}

?&gt;

&lt;a href="logout.php"&gt;Logout&lt;/a&gt;


logout.php

&lt;?php   
    session_start();

    session_destroy();
    header("Location: index.php");
?&gt;


Here is my form:

 &lt;form action="index.php" method="POST" autocomplete="off"&gt;
    &lt;input type="text" name="username" placeholder="Username" /&gt;
    &lt;input type="password" name="password" placeholder="Password" /&gt;
    &lt;input type="submit" name="submit" value="Login" /&gt;
 &lt;/form&gt;
Here are few things I observed:


You repeated session_start() twice in your member.php - you can only do that once in order to start the session
You are not sanitizing your input for bad values - its best practice to do so to avoid SQL injection - however as a beginner its a good idea that you started with PDO and not legacy mysql_query
After a redirect you should exit(); because your script will continue to process until end of the file. Why let a script continue when you're done.
I know you are trying to section your code but if PHP code continues don't close it un-necessarily. (referring to index.php and to the if error part).
You should use require or require_once. include causes an error if include is invoked (by mistake) more than one time.
Last observation would be in your member.php it should be a blacklist if and not if/else. You should basically tell the user that you shouldn't be here if you are not logged in..if not just proceed to the rest of the script (ask question if you didn't understand this part)