Html çok boyutlu dizi

0 Cevap php

I've table called options. Usually data from this table is displayed as checkbox on the web. The option table has optionname and optionprice. So my code goes something like this

<input type="checkbox" name="opt[]" value="<?php echo $option['optionname']?>"> 
$opts = $_POST['opt'];

if (empty ($opts)) {
   $selected = ' ';
}
else {
   $n = count($opts);
   for($j=0; $j < $n; $j++) {
       mysql_data_seek($result, 0);
       if($j!=0) $selected = $selected.',';
       $selected = $selected.$opts[$j];
       //$selected = $opts[$j];

   while($option=mysql_fetch_assoc($result)){
       if($option['optionname']==$opts[$j]){
         $val->ins_cartopt(mysql_insert_id(), $option['optionname'], $option['optionprice'], $_POST['itemid']);

       }
   }
   }

}

In the above code I'm not processing optioprice.So in ins_cartopt(optionprice) goes as 0. Now I want to process optionprice as well.

Ve sorun, her OptionName farklı optionprice vardı olduğunu.

Ben o ben hem de diğer yollarla açıklamak değilse bana clear.Let umuyoruz.

0 Cevap