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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php print_r($_POST); $userparam = test['sam'][]; // How to check if

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: 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

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: 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

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: 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

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Richard Davey wrote: 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

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php print_r($_POST); $userparam = test['sam'][]; // How to check if

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: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
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) character for inclusion in an array key. Cheers, Rich in this

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
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) character for inclusion in an array key. Cheers, Rich if you

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi Jim, Tuesday, June 19, 2007, 5:06:47 PM, you wrote: DON'T USE SINGLE QUOTES IN YOUR NAME= ATTRIBUTE where in this sentence did I say that it was invalid? just told you not to use them, because it is going to mess with your output Hate to piss on your bonfire but

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas 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) character for inclusion in an array key.

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Stut wrote: Jim Lucas 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) character for inclusion in an array

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Jim Lucas wrote: $userparam = test['sam'][]; then what you are saying it that this HAS to be your search string? -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William

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: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas wrote: Stut wrote: Jim Lucas 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) character for

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: 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

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: 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

Re: [PHP] Comparing string to array

2007-06-19 Thread Stut
Jim Lucas wrote: Richard Davey wrote: 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

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: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Stut wrote: Jim Lucas wrote: Richard Davey wrote: 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

Re: [PHP] Comparing string to array

2007-06-19 Thread Jim Lucas
Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php print_r($_POST); $userparam = test['sam'][]; // How to check if

Re: [PHP] Comparing string to array

2007-06-19 Thread Robin Vickery
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) // returns true if key is set full_find_key(test['sam'][], $_POST)

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) //

[PHP] Comparing string to array

2007-06-18 Thread Richard Davey
Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php print_r($_POST); $userparam = test['sam'][]; // How to check if $userparam exists in

Re: [PHP] Comparing string to array

2007-06-18 Thread Larry Garfield
Perhaps you're looking for in_array()? On Monday 18 June 2007, Richard Davey wrote: Hi all, Ok it's 2am, my brain has gone to mush and I am having trouble figuring out an easy way to do this, can anyone shed some light? Take a peek at the following code: // START pre ?php