PDA

View Full Version : array help


Keiichi
06-03-2001, 05:45 PM
i have a codes similar to:

$names = array(
"mon" => "money",
"chi" => "chicken"
};

i tried echoing $names[0] and $names[mon], and they both get "money"

when i use a form and lets say "mon" is a value of $thing after i submit it. i tried $names[$thing] and it doesn't output anything.
does anyone know how to get this to work using $thing?

Keiichi
06-03-2001, 09:21 PM
nevermind. stupid me, i was using the wrong variable *bonks head* that thing does work..

Rich
06-03-2001, 09:32 PM
What happens when you do:

$thing = "mon";
echo $names[$thing];

The results from the above should tell you where to investigate.

Rich

Keiichi
06-04-2001, 12:54 AM
i should've done that :þ
[This message has been edited by Keiichi (edited 06-03-01@11:55 pm)]