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

slight propblem with $_POST

Development and Programming

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

I was wondering if someone could help me out with a little problem.

In a new control panel interface I have a form posted, when I print the array, im getting weird duplicated values of the arrays with underscores tagged onto the end of $_POST.

Array ( [6] => Array ( [is_staff] => y ) [7] => Array ( [can_admin_members] => y ) [8] => Array ( [is_staff] => y [can_admin_members] => y ) [6_is_staff] => y [7_can_admin_members] => y [8_is_staff] => y [8_can_admin_members] => y )

this shouldnt be there:

[6_is_staff] => y [7_can_admin_members] => y [8_is_staff] => y [8_can_admin_members] => y )

the form is basically is as follows:

$r .=    $DSP->td().
$DSP->input_checkbox($row['group_id'].'[is_staff]', 'y' ).
$DSP->td_c();
        

$r .=    $DSP->td().
$DSP->input_checkbox($row['group_id'].'[can_admin_members]', 'y' ).$DSP->td_c();

Is this a php or EE problem? Its really a pain because I will need to remove those extra values before processing into the database.

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

Im doing another website now, and getting the same problem. Can anybody help me out with this? Its really screwing up the processing of the form.

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

heres another example of print_r($_POST):

[15] => Array
        (
            [title] => SH-01
            [field_id_5] => Square
            [field_id_6] => 56
            [field_id_7] => 67
            [field_id_8] => 6
            [field_id_9] => Array
                (
                    [0] => white_script
                    [1] => white_laser
                )

        )

    [16] => Array
        (
            [title] => SH-02
            [field_id_5] => Oval
            [field_id_6] => 78
            [field_id_7] => 78
            [field_id_8] => 9
            [field_id_9] => Array
                (
                    [0] => white_script
                )

        )

    [15_title] => SH-01
    [15_field_id_5] => Square
    [15_field_id_6] => 56
    [15_field_id_7] => 67
    [15_field_id_8] => 6
    [15_field_id_9] => Array
        (
            [0] => white_script
            [1] => white_laser
        )

    [16_title] => SH-02
    [16_field_id_5] => Oval
    [16_field_id_6] => 78
    [16_field_id_7] => 78
    [16_field_id_8] => 9
    [16_field_id_9] => Array
        (
            [0] => white_script
        )
       
Paul Burdick's avatar
Paul Burdick
480 posts
17 years ago
Paul Burdick's avatar Paul Burdick

ExpressionEngine, rather sillily we have decided, makes all POST values that are arrays into regular array values. We did this as it eased some processing early on. However, we have stopped using it altogether and are removing the code in core.input.php that does it entirely in 2.0.

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

Oh. ok. Thanks for the reply. Ive made a little regular expression to get rid of them for the mean time.

       

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.