You could instantiate the Error Object after the $_POST['go'] is set (the bottom part).
var $error = "You must put in a name";
var $good = "good work, name has been entered";
$pattern = '/[A-Za-z]+/';
if(!empty($_POST['name']) && preg_match($pattern, $_POST['name']))
It is Echoing out something cause you have a condition that will either Output $good or $bad.
$errorCode = new error();
So you should only echo the object once the Submit $_POST['go'] is placed.