Re: Oputting Forms Within a Class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



CK wrote:
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(){
You should probably use the echo function to output the HTML...
i.e.
echo "<!-- Script 10.1 - calculator.php--><br/>\n";
...
<!--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?

--PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux