I have problem with PHP and globals. In this code:
- at the page starts, the result is:
Test 123
. - After click in: ListBox1Click the result is:
XXXXXXXX
. - After click in: ListBox2Click the result is:
Test 123
which is wrong!
Is there any method where I can change global variable in this way? It's need to be change from inside "ListBox1Click" function and displays from code in: "ListBox2Click" function.
<?php
require_once("rpcl/rpcl.inc.php");
//Includes
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");
//Class definition
class Page1 extends Page
{
public $Label8 = null;
global $someVar;
$someVar = "Test 123";
$this->Label8->Caption = $someVar;
function ListBox1Click($sender, $params)
{
global $someVar;
$someVar = "XXXXXXXX";
$this->Label8->Caption = $someVar;
}
function ListBox2Click($sender, $params)
{
global $someVar;
$this->Label8->Caption = $someVar;
}
}
global $application;
global $Page1;
//Creates the form
$Page1=new Page1($application);
//Read from resource file
$Page1->loadResource(__FILE__);
//Shows the form
$Page1->show();
?>
Thanks for help
Your solution could look like this: