PHP: Store multiple select values in array -


there maximum 8 <select name="a"> , need store these values in array

$a = $_post['a']; $b = $_post['b'];  if (isset($a, $b)) {     foreach ($products $thisproduct) {         if ($thisproduct->getid() == $a) {         //do & store in array             switch($b){                 case "one":                 //do                 break;                  case "two":                 //do                 break;                  case "three":                 //do                 break;             }         }     } } //call array , make array_sum()... 

how store these in array use array making calculations?

update

there 8 input fields amount. input multiply value of $a.

foreach ($products $thisproduct) {      foreach ($a $value) {         if ($thisproduct->getid() == $value) {             $multiply = ($thisproduct->getmultiply($amount));             array_push($array, $multiply);           }     } } 

how can link each input select name="[a]"?

use <select name=a[]> , use code

$a = $_post['a']; foreach($a $value){    // } 

Comments