I'm new to PDO, so I apologise if this is a silly question. I have two files: writel.html contains a simple form, with formaction="submitArticle.php" and method="post". submitArticle.php contains the following:
<?php
$con = new PDO('mysql:host=localhost;dbname=mysql','root','root');
$submission = $con->prepare("
    INSERT INTO sfWritings(title, summary, content)
    VALUES(:title, :summary, :content)
    ");
$submission_execution = $submission->execute([
    'title' => $_POST['title'],
    'summary' => $_POST['summary'],
    'content' => $_POST['content']
    ]);
if($submission_execution) {
    echo "article submitted";
}
?>
However, instead of getting either the echo message, or some sort of error, I simply get the whole code, as if it doesn't realise it's PHP or something:

If I add some html tags (<html>, <body> etc.) then it starts giving me this:

The database is ok (I've been able to fetch some test data from it). And the way I'm doing the insert closely follows a (working) example for a tutorial. So I''m a bit stuck for what I'm doing wrong!
 
    