Jump to content

Accessing elements in embedded _POST array


radi8

Recommended Posts

Ok, I am very rusty at my PHP and this should be a simple question.

 

I have a page that will post the following arrays:

--> Form data (POST) <-- 
Array
(
    [matType] => Array
        (
            [0] => Repro:MultiColor
            [1] => Repro:Natural
            [2] => Repro:HMW
            [3] => Regrind:Natural
            [4] => Regrind:MultiColor
            [5] => Regrind:HMW
            [6] => Regrind:Inj. Crate
            [7] => Regrind:Inj LD
        )

    [LOW_MI] => Array
        (
            [0] => 0.16
            [1] => 0.45
            [2] => 0.025
            [3] => 0.45
            [4] => 0.15
            [5] => 0.25
            [6] => 3
            [7] => 3
        )

    [HIGH_MI] => Array
        (
            [0] => 0.5
            [1] => 0.75
            [2] => 0.1
            [3] => 0.75
            [4] => 0.55
            [5] => 0.1
            [6] => 7
            [7] => 7
        )

    [selectedRow] => 6
    [updateRow] => Update Selected Row
    [action] => submitted
)

I need to be able to access the embedded arrays and get to the selected element in each (element 6 in this case)

 

What is the syntax to get to the array element I need?

i.e.

$selRow= $_POST['SelectedRow']; // returns 6
$materialType = $_POST['matType'] ;//???? I need element from position 6 or "Regrind:Inj. Crate"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.