Mailing List Archive



Back to the month index Back to the list index

Mitch Shields (mshields@intellops.com)
Fri, 2 Apr 1999 13:34:39 -0600


Message-ID: <002e01be7d3f$d9f66d90$0101010a@200mmx>
From: "Mitch Shields" <mshields@intellops.com>
Subject: Re: Lite / Form Question
Date: Fri, 2 Apr 1999 13:34:39 -0600

Actually, createVariable is useful if you ever need to dynamically
"mass-create" variables through a loop (though I am not sure why you
wouldn't just use an array at that point). What I am looking for would be a
function that would allow me to specify a string as an argument and return
the value of an already existing variable that matches that string.
Something more like:

  $i = 0;
  while ($i < 11)
  {
    $foo = "$client_" + (char) $i;
    $value[$i] = extractVariable( $foo)
    $i = $i + 1;
  }

extractVariable() would be a Lite function that returns the value of the
string representation of the variable.
My form would have a number of fields named client_0 through client_10 and
that code would let me assign the values of those fields to the $value
array. I would prefer that to the overhead of some symbol table that
contained every field from the submitted form.

----- Original Message -----
From: Darrell Schulte <dschulte@facstaff.wisc.edu>
To: Multiple recipients of list <msql-list@services.bunyip.com>
Sent: Thursday, April 01, 1999 12:34 PM
Subject: Re: Lite / Form Question

> At 1:04 PM -0500 4/1/99, Mitch Shields wrote:
> +I would like to add my support for some sort of object like that or the
> +ability in lite to create a string and then evaluate that string as
though
> +it where a variable.
> +
> +For instance, if I have form fields named $client_0, $client_1,
$client_2, I
> +would like to be able to do something like this:
> +
> +$i = 0
> +while ($i < 3)
> +{
> + $value[$i] = $client_$i
> +}
> +
> +Or is something like that available now?
>
> Mitch,
>
> Would this do it? (never used it and not completely sure when I'd ever
use it)
>
> Lite / w3-mSQL
> --------------
>
> o The createVariable() function has been added to the standard
> module to allow dynamic creation of variables. It takes the
> name and value of the variable as it's two args. The name
> _MUST_ include wither a '$' for a local scope variable or a
> '@' for global scope variables. If the name does not start
> with either '$' or '@' the function call fails.
>
> e.g. createVariable("$myVariable","My Variable Value");
> $foo = "$baa";
> createVariable($foo, "The variable is called $baa");
>
> Darrell
> _____________________________________________________________________
> Darrell A. Schulte - dschulte@facstaff.wisc.edu
> University of Wisconsin-Madison - Office of News and Public Affairs
> The Why Files http://whyfiles.news.wisc.edu - The Graduate School
> 102A Bascom Hall, 500 Lincoln Drive - Madison WI 53706 (608) 265-8551