counting items chosen in $_POST |
I have a form that is being returned when a user submits. The $_POST array comes back as an array of arrays. All of the elements are available, except I have two sections that use buttons. In those sections of the array I get an array element like this:
$BC = {array} [1] 0 = {array} [2] 1 = "Pear Pie" 0 = "Applefishy" How can I get a count of how many elements appear in the sub-array? For example, in this case the answer is 2. In this case the answer is one: $PR = {array} [1] 0 = {array} [1] 0 = "test project" What function can I call on $PR or $BC to get that integer?
proof that an old dog can learn new tricks
Hi man face same issue but solve it
Object or array in url is parae by browser You need parse_str($url) isset($_GET['q']) ? parse_str($request->getGet('q'), $this->q) : $this->q = []; https://forum.codeigniter.com/thread-793...#pid387569 I tested with ci4 and angular11 Go there look propert $q(query)
Enlightenment Is Freedom
(06-11-2021, 03:38 PM)richb201 Wrote: I have a form that is being returned when a user submits. The $_POST array comes back as an array of arrays. All of the elements are available, except I have two sections that use buttons. In those sections of the array I get an array element like this: Can you attached a txt file of a var_dump($_POST) ?
Use Count Recursive and subtract the First level count, like this:
PHP Code: count($BC, COUNT_RECURSIVE) - count($BC); PHP.net - count What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(06-12-2021, 01:26 AM)InsiteFX Wrote: Use Count Recursive and subtract the First level count, like this:
proof that an old dog can learn new tricks
|
Welcome Guest, Not a member yet? Register Sign In |