When I have PHP in my file, the page shows blank and when looking at the source it shows that their is totally no tags on the page. When I remove my PHP the form shows just fine, but when the PHP is there.
<?php
$title = $_POST['title'];
$subcontent = $_POST['subcontent'];
$content = $_POST['content'];
if(empty($content)){
echo "<p>Create a new post</p>";
}
else{
echo "<p style='color:green;'>success</p> " . $content;
$time = date("j, n, Y");
$db = new mysqli("localhost", "admin", "pass", "db");
mysqli_query($db, "SELECT * from Articles");
mysqli_query($db, "INSERT INTO Articles (Title, subcontent, Content, Date) VALUES ('$title', '$subcontent' ,'$content', '$time')");
?>
<!DOCTYPE html>
<html>
<head><title>Post a new article</title></head>
<body>
<form method="post">
<input type="text" name="title" placeholder="Enter post Title"/>
<input type="text" name="subcontent" placeholder="Enter sub-content"/>
<input type="text" name="content" placeholder="Enter content"/>
<input type="submit" value="post"/>
</form>
</body>
</html>