php script echoing part of the php instead of what intended
<p>im having trouble with php script that ive created to insert instances into a database, however im getting a trivial output and i dont know how to fix it. the code is:</p>

<pre><code>&lt;?php

    try{
        $user = 'root';
        $pass = null;
        $pdo = new PDO('mysql:host=localhost; dbname=divebay', $user, $pass);

        $pdo-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

        $username = $_POST['username'];
        $password = sha1($_POST['password']);
        $location = %_POST['location'];
        $email = $_POST['email'];
        $name = $_POST['fname'] . " " . $_POST['surname'];

        $check = $pdo-&gt;prepare('SELECT * FROM user WHERE username=?');
        $check-&gt;bindValue(1, $username);
        $check-&gt;execute();

        if($check-&gt;fetch(PDO::FETCH_OBJ)){
            echo "Account name already exists";
        }
        else{

            $stmt = $pdo-&gt;prepare('INSERT INTO user(username, password, location, email, name)
                                  VALUES(:username, :password, :location, :email, :name)');
            $stmt-&gt;bindParam(':username', $username, PDO::PARAM_STR);
            $stmt-&gt;bindParam(':password', $password, PDO::PARAM_STR);
            $stmt-&gt;bindParam(':location', $location, PDO::PARAM_STR);
            $stmt-&gt;bindParam(':email', $email, PDO::PARAM_STR);
            $stmt-&gt;bindParam(':name', $name, PDO::PARAM_STR);

            if($stmt-&gt;execute()){
                echo "Account created";
            }
            else{
                echo "Account could not be created";
            }
        }

        $pdo = null;

    }catch(PDOException $e){
        echo $e-&gt;getMessage();
    }


?&gt;
</code></pre>

<p>i would expect the output to be something like "Account created". Instead the output im getting is (this is not code, but the output the script generates):</p>

<p>setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $username = $_POST['username']; $password = sha1($_POST['password']); $location = %_POST['location']; $email = $_POST['email']; $name = $_POST['fname'] . " " . $_POST['surname']; $check = $pdo->prepare('SELECT * FROM user WHERE username=?'); $check->bindValue(1, $username); $check->execute(); if($check->fetch(PDO::FETCH_OBJ)){ echo "Account name already exists"; } else{ $stmt = $pdo->prepare('INSERT INTO user(username, password, location, email, name) VALUES(:username, :password, :location, :email, :name)'); $stmt->bindParam(':username', $username, PDO::PARAM_STR); $stmt->bindParam(':password', $password, PDO::PARAM_STR); $stmt->bindParam(':location', $location, PDO::PARAM_STR); $stmt->bindParam(':email', $email, PDO::PARAM_STR); $stmt->bindParam(':name', $name, PDO::PARAM_STR); if($stmt->execute()){ echo "Account created"; } else{ echo "Account could not be created"; } } $pdo = null; }catch(PDOException $e){ echo $e->getMessage(); } ?></p>

<p>whats going wrong with this script to cause this?</p>
