//Includes
require_once(”vcl/vcl.inc.php”);
use_unit(”forms.inc.php”);
use_unit(”extctrls.inc.php”);
use_unit(”stdctrls.inc.php”);
//Class definition
class Unit3 extends Page
{
public $txtAnswer = null;
public $btnB = null;
public $btnA = null;
public $btnRun = null;
public $lblMsg = null;
public $Button4 = null;
public $Button2 = null;
function btnRunClick($sender, $params)
{
$a=rand(1,9);
$b=rand(1,9);
$this->btnA->Caption=$a;
$this->btnB->Caption=$b;
$this->lblMsg->Caption=” “;
$this->txtAnswer->Text=” “;
}
function txtAnswerSubmit($sender, $params)
{
global $a;
global $b;
global $c0;
global $c1;
$a=$this->btnA->Caption;
$b=$this->btnB->Caption;
$c0=$a+$b;
$c1=$this->txtAnswer->Text;
if ($c0==$c1){$this->lblMsg->Caption=”Right”;
} else {$this->lblMsg->Caption=”Wrong”;
}
}
}
global $application;
global $Unit3;
//Creates the form
$Unit3=new Unit3($application);
//Read from resource file
$Unit3->loadResource(__FILE__);
//Shows the form
$Unit3->show();
?>