function test_posts_and_rails_span_the_length_required()
 {
     $a = new PostsRails();
     $this->assertEquals('To make a fence 6.5 meters long you need 5 posts and 4 rails.', $a->postsRailsNeeded(6.5));
 }
<?php

require_once 'src/PostsRails.php';
$a = new PostsRails();
if (isset($_POST['posts'])) {
    $message = $a->fenceLength($_POST['posts'], $_POST['rails']);
}
if (isset($_POST['length']) && $_POST['length'] != '') {
    $message = $a->postsRailsNeeded($_POST['length']);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<form action="" method="post">
    Number of posts <input type="text" name="posts" id="posts">
    Number of rails <input type="text" name="rails" id="rails">
    Length of fence required <input type="text" name="length" id="length">
    <input type="submit" value="submit">
</form>

<h1>
    <?php 
echo $message;
?>
</h1>