Oputting Forms Within a Class
| From: | CK | Date: | Tue, 10 Apr 2007 17:49:46 +0000 |
| Subject: | Oputting Forms Within a Class | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-252444@lists.php.net to get a copy of this message | ||
Hi All,
Experimenting with OOP PHP,please be gentle. Attempting to output a form within a class:
From calculator.php:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Calculator OOP PHP</title>
</head>
<body>
<?php
include "class.calculator.php";
?>
</body>
</html>
From class.calculator.php:
<?php
class Calculator{
//variable declaration
//constuctor function
function __construct(){//calls all methods
$this->buildInt();
}
private function buildInt(){
<!--Script 10.1- calculator.php-->
<form action="calculator.php" method="post">
//Form elements omitted for brevity....
</form>
}
}
?>
This is returned to the browser:
"Parse error: syntax error, unexpected '<' in /Users/chris/Sites/php/oop/class.calculator.php on line 20"
What concept did I miss, if some online reference is available please pass along?