|
Posted by Troot on 05/05/06 14:27
Hi All,
I've attached some code below. My problem is the following, I have the
two variables $name and $pword. I'm passing values for them via xml. I
have declared them as global and then try to set them using the eval
statement. If I send the response with their values inside the
handleOpenElement function, it works. But, if I try to send the
response after the function has exited, I don't get anything.
Can anybody tell what I'm doing wrong? Have I misinterpreted the global
variable system?
Thanks
Troot
$uname = "";
$pword = "";
function sendResponse($errorMsg){
header('Content-type: text/xml');
print "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><node><sendvar
name=\"d_status\" value=\"" . $errorMsg . "\"/></node>";
exit;
}
function handleOpenElement($p, $element, $attributes){
global $uname;
global $pword;
$element = strtolower($element);
switch($element){
case 'sendvar':
eval("\$" . $attributes['NAME'] . " = \"" . $attributes['VALUE'] .
"\";");
break;
}
}
sendResponse($uname);
Navigation:
[Reply to this message]
|