Reply to Globals problem (I think)

Your name:

Reply:


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);

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация