Back to the month index |
Back to the list index
|
Joern Krueger (jkrueger@muenster.de)
Wed, 07 Apr 1999 07:49:01 +0200
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
- Next message: Georg Horn: "Re: Lite / Form Question"
- Previous message: David J. Hughes: "Re: Lite / Form Question"
Message-ID: <370AF1CD.FDA010F7@muenster.de> Date: Wed, 07 Apr 1999 07:49:01 +0200 From: Joern Krueger <jkrueger@muenster.de> Subject: Arrays in LiteHello,
I use a html form with some checkbox fields with the
same name.
<input type="checkbox" name="checkbox" value=42>
<input type="checkbox" name="checkbox" value=43>
<input type="checkbox" name="checkbox" value=44>
After submitting the form I check the variables with
this lite code:
$i=0;
while(# $checkbox[$i] != "")
{
script($checkbox[$i]);
$i++;
}
This works, if two checkboxes where marked, but if only
one checkbox is marked the value, 42 i.e. is splitted into
4 and 2.
Can someone help me?
-- Bye, Joern From bambi@Hughes.com.au Wed Apr 7 02:51:14 1999 Received: from sonic.fan.net.au (sonic.fan.net.au [203.20.92.3]) by services.bunyip.com (8.8.5/8.8.5) with ESMTP id CAA15583 for <msql-list@services.bunyip.com>; Wed, 7 Apr 1999 02:51:12 -0400 (EDT) Received: from fawn.Hughes.com.au (fawn.hughes.com.au [203.23.133.33]) by sonic.fan.net.au (8.9.1/8.9.1) with ESMTP id QAA27471; Wed, 7 Apr 1999 16:51:09 +1000 (EST) Received: from localhost (Received: from localhost (hughes@localhost) by fawn.Hughes.com.au (8.8.7/8.8.5) with SMTP id QAA12052; Wed, 7 Apr 1999 16:51:11 +1000 (EST) X-Authentication-Warning: fawn.hughes.com.au: hughes owned process doing -bs Date: Wed, 7 Apr 1999 16:51:10 +1000 (EST) From: "David J. Hughes" <bambi@Hughes.com.au> To: Joern Krueger <jkrueger@muenster.de> cc: Multiple recipients of list <msql-list@services.bunyip.com> Subject: Re: Arrays in Lite In-Reply-To: <370AF1CD.FDA010F7@muenster.de> Message-ID: <Pine.BSF.3.96.990407164801.518Q-100000@fawn.hughes.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCIIOn Wed, 7 Apr 1999, Joern Krueger wrote:
> After submitting the form I check the variables with > this lite code: > > $i=0; > > while(# $checkbox[$i] != "") > { > script($checkbox[$i]); > $i++; > } > > This works, if two checkboxes where marked, but if only > one checkbox is marked the value, 42 i.e. is splitted into > 4 and 2.
If more than one box is checked then there are multiple values being passed through to the LVM under the same name (i.e. $checkbox in this case). The LVM will create an array variable to hold the info. If only one value is passed through, then the LVM will create a text value rather than an array because it hasn't been asked to store multiple values in the same variable. Using $checkbox[0] is returning the first character of a string in this case.
You can determine the type of the $checkbox variable by calling
typeof($checkbox);
if it isn't an array then you don't need to loop over it.
Bambi ...
- Next message: Georg Horn: "Re: Lite / Form Question"
- Previous message: David J. Hughes: "Re: Lite / Form Question"