<?php
class Calculator
{
	var $answer=10;
	function add($a,$b)
	{
		$this->answer=$a+$b;
		return $this->answer;
	}
}

$mycalc=new Calculator;
print $mycalc->add($value1,$value2);
//print $mycalc -> answer;
?> 
<form action = "inclass2.php" method = "post">
<input type= "text" name = "value1"> + <input type= "text" name = "value2">
<input type= "submit" name = "submit" value="Add">
</form>