I have a similar problem: I want to use a global field to pass values from my script to the php frontent (like logical error messages). I 'am wondering if it is at all possible to use global ields in the php environment.
Disclaimer: I'm an absolute PHP noob.
Are you using PHP prevalidation (validate() method)? This does not support validation by calculation, as the FMS CWP with PHP guide states on p. 41.
If you do after-validation (let the database validate): There is the setField method, which however is derived from a record object (Chapter editing records in FMS CWP with PHP guide, p. 30). I'm not sure if you can take a random record object and use setField(name of global field, value) to update the global. But is this a global that is stored within a session and is different from session to session?
But by browsing the FMS CWP guide for PHP and the PHP API reference, get the impression that global fields are not supported much (there is, although, a isGlobal() method).
However, in XML/XSLT CWP they are, but you need to turn on database sessions so that the value of a global field is maintained between requests during a session. I see nothing similar for CWP with PHP.