Click to See Complete Forum and Search --> : php form array problem


knavely
12-06-2003, 06:18 AM
hi im trying to acess an array from a form

heres part of the form
<input type="radio" name = "recipe['Chillie']" value = "0"> not presant
<input type="radio" name = "recipe['Chillie']" value = "1"> some
<input type="radio" name = "recipe['Chillie']" value = "2"> significant amount
<input type="radio" name = "recipe['Chillie']" value = "3"> quite a bit<br />

the wierd thing is that in my code
i do $recipe = $HTTP_POST_VARS['recipe'];
then when i want to access the element i try
$recipe['Chillie'];
but i get nothing!
i know its in there some where casue when i do
foreach($recipe as $key => $current)

it tells me that there is a key that is equal to 'Chillie'

any help is appriciated...i must be missing some little thing.

theN
12-09-2003, 04:18 AM
$recipe = $HTTP_POST_VARS['recipe'];Are you trying to copy the form-array recipe into $recipe?

AFAIK, you must assign an element in the form-array recipe to $recipe i.e.
$recipe = $HTTP_POST_VARS['recipe[Chillie]'];

I may me mistaken about what you want :(

regards
akr