Actually i want to add both the values of ids 2 and the ids 3

<form method="post" name="fo" action="#">
    <input type="text" name="ids[]" value="2"/>
    <input type="text" name="amount[]" value="100"/>
    <input type="text" name="ids[]" value="3"/>
    <input type="text" name="amount[]" value="200"/>
    <input type="text" name="ids[]" value="2"/>
    <input type="text" name="amount[]" value="300"/>
    <input type="text" name="ids[]" value="3"/>
    <input type="text" name="amount[]" value="50"/>
    <input type="submit" name="submit"/>
</form>

<?php
$id=$_POST['ids'];
$am=$_POST['amount'];

$arr=array(
           array('id'=> $id,'am'=>$am)

           );

$heads = array();
$amounts = array();
$i = 0;
foreach($arr as $sub)
{
    $key = array_search($sub['id'], $heads);
    if($key)
    {
        $amounts[$key] += $sub['am'];
    }
    else
    {
        $heads["'" . $i . "'"] = $sub['id'];
        $amounts["'" . $i . "'"] = $sub['am'];
        $i++;
    }
}

print_r($heads);
print_r($amounts);
}

?>

What are you trying to accomplish? When you say " Multidementional Array" from form, what are you doing with the array? The for post data is aready array.

Give your input fields names like id1, id2, id3 etc and amount 1, amount2, amount3, etc
THEN build your array by putting these values into their corresponding places in your array. You do this by having an action file for when the sumbit button is clicked.
Currently your form has no action, therefore no action will take place as the form input isn't being processed in any way. It's a dead form.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.