hello friends.. i am trying to create calculator using OOPs.. its my first assignment in oops
i have created a class in cal.php
<?php
class calculator
{
public $one;
public $two;
public function __construct($one,$two)
{
$this->one=$one;
$this->two=$two;
}
function sum()
{
$result=$this->one + $this->two;
echo "Sum = ".$result;
}
function sub()
{
$result=$this->one - $this->two;
echo "Subtraction = ".$result;
}
function multi()
{
$result=$this->one * $this->two;
echo "Multiplication = ".$result;
}
function div()
{
$result=$this->one / $this->two;
echo "Division = ".$result;
}
}
?>
i have created a form for user input for calculator in form.php
<form action="cal.php" method="post" >
Value 1 <input type="text" name="value1" />
Value 2<input type="text" name="value2" />
<input type="submit" value="Submit">
</form>
i dont know how to move on now??/
how to fetch values to next page in oops and use them in object??? can we use $_POST ??