$_post multidimensional array

Greetings,

I’m trying to find answer to my questions for several days now, none of the similar issues gave me solution…

what I’m trying to do is to list some rows from a database :


<p><b><?=$contact_fullname;?></b><br />
<?=$contact_group;?>/<?=$contact_category;?>/<?=$contact_subgroup;?><br />
<input type="hidden" name="invited_fullname[<?=$contact_ID;?>]" value="<?=$contact_fullname;?>" />
<input type="hidden" name="invited_email[<?=$contact_ID;?>]" value="<?=$contact_email;?>" />
<input type="hidden" name="inv_to" value="<?=$inv_to;?>" />
<input type="hidden" name="page_id" value="<?=$page_id;?>" />
<input type="checkbox" name="select_contact[<?=$contact_ID;?>]" value="<?=$contact_username;?>" />Select
</p>

and then to retrieve the values in the post page.
At this point I couldn’t retrieve the ‘invited_fullname’ and ‘invited_email’ values. I tried several syntaxes, looked at the php manual I couldn’t figure out how to get those values…
Here’s what I have to retrieve the rest :


foreach($_POST['select_contact'] as $key => $value){
		
$now                    = date("Y-m-d, G:i");
$inv_to                 = strip_tags($_POST['inv_to']);
$page_id               = strip_tags($_POST['page_id']);
$invited_email        = strip_tags($_POST['invited_email[$key]']);
$invited_fullname    = strip_tags($_POST['invited_fullname[$key]']);

// SQL processing
// mail sending
}

I bet it is a syntax issue - unfortunately I’m not a professional so any help or suggestion is much much appreciated!

try this


$_POST['invited_email'][$key]
$_POST['invited_fullname'][$key]

where did you set the ‘invited_fullname’ and ‘invited_email’ ?

It should be $_POST[‘invited_email’][$key] instead of $_POST[‘invited_email[$key]’]

Try var_dump($_POST) in your PHP to see how the array is built :slight_smile:

Thank you guys!