Re: Newb question about getting keys/values from a single array element

From: Date: Fri, 09 Oct 2009 14:47:33 +0000
Subject: Re: Newb question about getting keys/values from a single array element
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-298817@lists.php.net to get a copy of this message
At 6:08 PM -0700 10/8/09, Daevid Vincent wrote:
I feel like a total newb asking this, but I'm just having a brain fart or something... I'm writing a page where I can either get back a list of items: Array { [1233] => "apple", [6342] => "apricot", [2345] => "banana", ... } where the user then refines it by choosing one single item and a single element array is returned like this: Array { [8575] => "peach", } How can I get this $item so I can print it like so: echo "The ID is $id and the name is $name";
I'm not sure what you are asking. How does the user pick from a list of items -- a selection list, a list of radio boxes, what? If you are using a post/get to get the values and thus passing only one value, then why not catenate the id with the value (e.g., 8575peach) and parse it after receiving? If you show me a url, then I can get a better understanding of what you are trying to do. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#298817) next »