FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » array filtering question
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: array filtering question [message #178187 is a reply to message #178185] Mon, 21 May 2012 15:20 Go to previous messageGo to previous message
bill is currently offline  bill
Messages: 310
Registered: October 2010
Karma:
Senior Member
On 5/21/2012 11:01 AM, Shake wrote:
> El 21/05/2012 16:22, bill escribió:
>> I have a POST array with about 200 elements.
>> There MAY be one or more key elements that start with deleteF~
>> (for example deleteF~EAP, deleteF~Lowfee)
>>
>> What I want to know is if any array element begins with deleteF~
>
> Perhaps you can use multidimensional array here.
>
> If you have something like:
>
> <input type="checkbox" name="item_1" value="x" />
> <input type="checkbox" name="[deleteF~][item_2]" value="x" />
> <input type="checkbox" name="item_3" value="x" />
> <input type="checkbox" name="[deleteF~][item_4]" value="x" />
>
> Perhaps if better to change to:
>
> Then the POST will be:
>
> $_POST['item_1] = 'X';
> $_POST['item_3] = 'X';
> $_POST['deleteF~']['item_2] = 'X';
> $_POST['deleteF~']['item_4] = 'X';
>
> And you can do:
>
> if(isset($_POST['deleteF~'])) foreach($_POST['deleteF~'] as $Item) {
>
> // Do things with this item.
> }
>
> greetings

Nice idea.

bill
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Latest project
Next Topic: array_walk always passing 0 as the parameter
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 22:55:54 GMT 2024

Total time taken to generate the page: 0.04128 seconds