We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Duplicate in$_POST

Development and Programming

vinci's avatar
vinci
85 posts
17 years ago
vinci's avatar vinci

Hey all, I have something weird happening here. In a module I have developed, I have a Form posting a series of checkboxes to $_POST as an array.. ie:

$r .= $DSP->input_checkbox("groups[]", $row['id'] , $selected ).NBS.$row['cat_name'];

as you can see the checkboxes are posting as an array The output $POST array contains the groups array pefectly like this:

groups[] => array([0]=>123, [1]=>456, [2]=>789)

thats perfect, but for some reason it is also appending , and auto-incrementing it seems, separate values at the end of the $_POST array like so:

[groups_0]=>123 [groups_1]=>456 [groups_2]=> 789

which is weird.

The function is fairly simple, so i wont post it here, ive looked at the 3 lines very closely and no, theres nothing that could be adding to $POST like that.

Im wondering if its a bug or maybe something that is supposed to happen when using $DSP->input_checkbox?

       
Corvaire Wind's avatar
Corvaire Wind
60 posts
17 years ago
Corvaire Wind's avatar Corvaire Wind

how about

$selected, '')

without the space?

       
vinci's avatar
vinci
85 posts
17 years ago
vinci's avatar vinci

yeah, i put that in there to see what would happen… it still does it without that extra ”;..

edited the above code..

       
Corvaire Wind's avatar
Corvaire Wind
60 posts
17 years ago
Corvaire Wind's avatar Corvaire Wind

try taking the period off the front of NBS and see what that does.

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Vinci,

I know you didn’t want to post the whole function but can you do that anyway?

Jamie

       
vinci's avatar
vinci
85 posts
16 years ago
vinci's avatar vinci

A few months on an ANOTHER module, and I am getting the same issue.

Simple form data, to post into an array within $_POST. I have say, a very simple form:

<input type="text" name="1[this]" value="xx"/>
<input type="text" name="1[that]" value="yy"/>

$_POST on the processing page will look like:

[1] => array([this] => xx, [that] => yy), [1_this] => xx, [1_that] => yy

Those last two variables SHOULDNT be there,

Does anyone think this could be a server issue (im using MAMP), such as an apache module messing with $_POST? or heaven forbid missed EE setting.. or worst case, EE bug?

       
vinci's avatar
vinci
85 posts
16 years ago
vinci's avatar vinci

Feature? its annoying as I will have to do quite a few preg_match’s on the $keys of the array to remove them!

is there an ‘off’ button anywhere?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.