prepare("INSERT INTO posts (url, content, author) VALUES (:url, :content, :author)"); $stmt->bindParam(":url", $postUrlGen); $stmt->bindParam(":content", $postBody); $stmt->bindParam(":author", $author); $stmt->execute(); // check if query was successful if($stmt) { header("Location: ../index.php"); } else { die("Something went wrong"); } } } ?>