Define constants: awkward usage?
| From: | tony | Date: | Wed, 26 Jan 2005 16:56:21 +0000 |
| Subject: | Define constants: awkward usage? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38364@lists.php.net to get a copy of this message | ||
Hi all,
I got this sets(20) of defined constants which using them as keys to an
array
eg
define("FNAME", "fname");
farray = array( FNAME => "hello" ,...);
my question is how do I insert that directly into a javascript(to do
some client validation)
I need this:
var fname = document.addrform.fname.value
var fname = document.addrform.{FName}.value //don't work
var fname = document.addrform.{'FName'}.value //don't work
var fname = document.addrform.[FName].value //don't work
I know this work, but messey
$tmp = FNAME;
var fname = document.addrform.{$tmp}.value
I'am finding the use of define constants rather awkward. does anyone
make much use of them?
Thanks
Tony