Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #6110
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.cablespeedmi.com!news.cablespeedmi.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Mon, 21 May 2012 14:13:14 -0500 |
| Date | Mon, 21 May 2012 15:13:12 -0400 |
| From | bill <nobody@spamcop.net> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.php |
| Subject | Re: array filtering question |
| References | <GuWdnQ9JU-sg0ifSnZ2dnUVZ_omdnZ2d@cablespeedmi.com> <jpdkh1$a9b$1@dont-email.me> <R_2dnT7fEJ8wwSfSnZ2dnUVZ_qidnZ2d@cablespeedmi.com> <jpdraj$ofl$1@dont-email.me> |
| In-Reply-To | <jpdraj$ofl$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Message-ID | <v8OdnframYdXDifSnZ2dnUVZ_uGdnZ2d@cablespeedmi.com> (permalink) |
| Lines | 91 |
| X-Usenet-Provider | http://www.giganews.com |
| NNTP-Posting-Host | 24.56.193.205 |
| X-Trace | sv3-LJJiQqTFds9byUAqTXD3tNA0SAEFaG91YS+F95xf5QfRdmKhFDoPF2gba+4MEjfQT8ONVmYyHxIKe80!i2vyxkQ+13c7e2t/9e40eTu4csLEkjcgHpscMGof0KMWUXwj/hcinhcQbhIgq1j5AgECSBtbV0k/!IZFpLWhHjwc4jgg95+9MsFfhyA== |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 4158 |
| Xref | csiph.com comp.lang.php:6110 |
Show key headers only | View raw
On 5/21/2012 12:42 PM, Jerry Stuckle wrote: > On 5/21/2012 11:18 AM, bill wrote: >> On 5/21/2012 10:46 AM, Jerry Stuckle wrote: >>> On 5/21/2012 10:22 AM, bill wrote: >>>> 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~ >>>> >>>> I looked at array_keys, array_filter and others, but they seem >>>> to all >>>> match the whole key string. >>>> >>>> I can process the whole array myself, but I am hoping that with >>>> all the >>>> array functions there might be one. >>>> >>>> It would be nice if I could apply an array function and get >>>> back an >>>> array with just those keys. (they are checkboxes so the value >>>> is always >>>> "on", just their presence is enough information.) >>>> >>>> bill >>> >>> There isn't a real easy way to do this other than going through >>> the whole array. >>> >>> However, I think your design could be improved. Why have multiple >>> checkboxes with different names and the same value? Why not have >>> all the checkboxes with the same name and different values? >>> >>> It would make processing much easier. >>> >> >> Thanks Jerry, >> >> There are major deletes (the ones I mentioned) and minor >> deletes AND >> about another 200 fields with values. This is how it appeared >> in the >> feeble thing I use for a brain. >> >> It only took me 4 lines to create the array with the keys I >> need in it. >> The key encodes the item to delete: apply substr to it and I >> have the >> items to delete and the class of item they represent (which >> leads to the >> file name...) >> >> I suppose I could do it the way you suggested, but then I'd >> need to get >> my mind wrapped around that design and this part of the project >> is 90% >> complete (which of course means it is 90% incomplete). >> >> Thanks for the reasurance. >> >> bill >> > > Actually, it shouldn't take any more to create the items with one > key and different ids. For instance, instead of creating > something like: > > <input type="checkbox" name="deleteField1" value="on"> > > You create > > <input type="checkbox" name="delete[]" value="Field1"> > > You can call your major and minor delete checkboxes different names. > > In this case, all the checkboxes with the name "delete[]" will be > in $_POST['delete'] array, i.e. > > $_POST['delete'][0] might equal 'Field1', > $_POST['delete'][1] might equal 'Field3' (Field 2 NOT being checked) > and so on. > > I find related checkboxes (i.e. similar processing for all) to be > much easier to handle this way. > Yes, that would have been. I didn't think about an array of checkboxes. If it doesn't fall out of my brain I will do it that way next time. Many thanks. bill
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
array filtering question bill <nobody@spamcop.net> - 2012-05-21 10:22 -0400
Re: array filtering question Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-21 10:46 -0400
Re: array filtering question bill <nobody@spamcop.net> - 2012-05-21 11:18 -0400
Re: array filtering question Jerry Stuckle <jstucklex@attglobal.net> - 2012-05-21 12:42 -0400
Re: array filtering question bill <nobody@spamcop.net> - 2012-05-21 15:13 -0400
Re: array filtering question Shake <QUITAESTO@QUITAESTO.NOES> - 2012-05-21 17:01 +0200
Re: array filtering question bill <nobody@spamcop.net> - 2012-05-21 11:20 -0400
Re: array filtering question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-21 19:26 +0200
Re: array filtering question bill <nobody@spamcop.net> - 2012-05-21 15:19 -0400
csiph-web