Page 1 of 1

Adding values into an array HELP HELP

Posted: Fri Jun 25, 2004 9:10 am
by stantheman
I want to be able to had values to an array one value at a time instead of all at once

here is an example of what i want to do
if check box is checked
{
array(1=>"True")
}
else
{
}

if checkbox2 is checked
{
array(2=>"True")
}
else
{
}

if is doesn't get checked i do not want to add anything to the array i only want to add things to the array if it is checked.

Posted: Fri Jun 25, 2004 9:20 am
by Wayne

Code: Select all

$your_arrayї1] = 'True'
etc. etc.

Posted: Fri Jun 25, 2004 9:23 am
by stantheman
ok so wqould the could look something like this

$arraytest = array()

$arraytest[1]='True'

then to print i do this right
echo $arraytest[1]

Posted: Fri Jun 25, 2004 9:25 am
by tim
the first item in an array would be targetted by $var[0];


the second $var[1]; and etc