I don't think you're getting the letters Array in the elements, but it's
telling you that $inputDepartment[$i] is an array. In other words
$inputDepartment is a multi-dimensional array.
Now, I haven't looked at the code, but I'm guessing that select box
is the only HTML form element in the page called
inputDepartment[]. What happens when you call it
inputDepartment[] is that for each element in the page called that
you get another element in an array. (because of the []s) Because
there is only one form element that is called inputDepartment, you
only have one element in the first dimension of the array. (Which is
why "Array" only prints out once)
The second dimension of the array are your values. So what you
have is an array that looks like this:
$inputDepartment[0][0]=1
$inputDepartment[0][1]=2
etc. for each item in the listbox.
So to print out the values, you want something like:
print "1st count=".count($inputDepartment)."<P>";
for ($x=0; $x<count($inputDepartment);$x++) {
print "2nd count=".count($inputDepartment[$x])."<P>";
if (count($inputDepartment[$x])>0) {
print "Dept=";
for ($i=0; $i<count($inputDepartment[$x]; $i++) {
print $inputDepartment[$x][$i];
}
}
}
Your output should be:
1st count=1
2nd count=2
Dept=12
Does that make sense?
On 3 Feb 2001, at 23:06, Van Vo wrote:
> Hi,
>
> I'm setting up ft and am having problems in ADD_ITEM/UPDATE_ITEM.
>
> The select box for $inputDepartment doesn't seem to be working for me.
>
> The HTML looks like this:
>
> <SELECT NAME="inputDepartment[]" MULTIPLE SIZE="5">
> <OPTION VALUE="1">bikes
> <OPTION VALUE="2">blades
> </SELECT>
>
> At the top of ADD_ITEM, I add the following lines:
>
> print "count=".count($inputDepartment)."<P>";
> if (count($inputDepartment)>0)
> {
> print "Dept=";
> for ($i=0; $i<9; $i++)
> {
> print $inputDepartment[$i];
> }
> }
>
> What I get is STRANGE:
>
> count=1
> Dept=Array
>
>
> That's right. I'm expecting a Dept value of 1|2 but I get the letters
> Array in the first 5 positions of the array. What am I missing here?
>
> Thanks,
> Van Vo
>
>
>
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Site: http://www.working-dogs.com/freetrade/
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Site: http://www.working-dogs.com/freetrade/
Problems?: [EMAIL PROTECTED]