Re: Re[2]: [PHP] Comparing string to array

2007-06-20 Thread Robin Vickery
On 19/06/07, Richard Davey [EMAIL PROTECTED] wrote: Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: On 19/06/07, Richard Davey [EMAIL PROTECTED] wrote: $userparam = test['sam'][]; // How to check if $userparam exists in the $_POST array // and get all the values

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Larry, Tuesday, June 19, 2007, 2:55:07 AM, you wrote: Perhaps you're looking for in_array()? If only it was that simple! But pray tell how an in_array search is going to find: $userparam = test['bob'][]; within: Array ( [test] = Array ( ['bob'] = Array

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 10:16:02 AM, you wrote: If you can't control $userparam and it has to look like you have it then you're parsing of it is a little more involved, but still fairly simple. What are you actually trying to do? Where will $userparam actually come from? There is

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 12:09:12 PM, you wrote: If you have no control over what the fields in the form will be, what are you doing with the data? Surely if you're writing logic that requires you to know what the fields are called, you need to have control over it. Here, this

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:16:54 PM, you wrote: The problem is finding a way to expand the input name (which is a string) into a format that $_POST can be searched for. Or do the reverse, iterate through $_POST to find a match for the input name and get that value. Try this overly

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Stut, Tuesday, June 19, 2007, 1:49:53 PM, you wrote: Very nice, thank you. I was hoping there would be a way to do it without resorting to eval(), but if even you can't figure out how, I'm not going to waste any more time trying to either :) You probably could by breaking it into each

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME= ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of) character for inclusion in an array key. Cheers, Rich -- Zend Certified Engineer

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:29:55 PM, you wrote: Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME= ATTRIBUTE Hate to piss on your bonfire but a single quote is a perfectly valid (if somewhat stupid choice of)

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 5:47:29 PM, you wrote: Jim Lucas wrote: $userparam = test['sam'][]; then what you are saying it that this HAS to be your search string? Heck no, it doesn't *have* to be. Feel free to remove the quotes from it and then attempt my original question

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Jim, Tuesday, June 19, 2007, 6:21:25 PM, you wrote: let me try this again. in the submitted $_POST array, you are looking for a key (test) that contains a given $username that may or may not have any values set? Correct? Sorry not even close. Here, let me try again... $param =

Re[2]: [PHP] Comparing string to array

2007-06-19 Thread Richard Davey
Hi Robin, Tuesday, June 19, 2007, 8:28:50 PM, you wrote: On 19/06/07, Richard Davey [EMAIL PROTECTED] wrote: $userparam = test['sam'][]; // How to check if $userparam exists in the $_POST array // and get all the values from it? full_key_exists(test['sam'][], $_POST) //