This is very similar to arrys_object.htm, here we are showing everything on one web page. The form is embeded in the web page.
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Pass ref of a varaiable</title>
</head>

<body text="#FFFF00" bgcolor="#000080">

<form action="array_object.php" method="post"><input type=text name="color">

<input type="submit" value="click"</form>
<?php
$xcolor=$_POST['color'];

class ColorFilter {
var $color ;
function ColorFilter($color) {
$this->color=$color;
}
function isPrimary () {
$primary=array('red','green','blue');
if (in_array($this->color,$primary))
return true;
else
return false;
}
}

//some how if you try to pass values to $mycolor=$_POST['color']
//it wil not work, to receive a value from input you must use as described below
//$filter=new ColorFilter($mycolor=$_POST['color']);

echo "<br>You entered $xcolor <br>";
$filter=new ColorFilter($mycolor=$_POST['color']);

if ($filter->isPrimary($myColor) ) {
echo ($myColor.'<br> It is a primary color');
} else {
echo ($myColor.' <br>It is not a primary color');
}

?>
</body>

</html>