i have been spending the entire weekend on this but cannot seem to get it solved.
My html consists of two drop down menus. One determines a specific type and the second determines a component.
There is predefined costs associated with each component based on the type its being used for.
Here my HTML:
<td><select name="type">
<option value= "0" selected>None</option>
<option value = "CAR">Car</option>
<option value = "VAN">Van</option>
<option value = "TRK">Truck</option>
</select></td>
<td>Component:</td>
<td><select name="component">
<option value= "0" selected>None</option>
<option value = "TIR">Oil</option>
<option value = "OIL">Tire</option>
<option value = "SPK">Spark Plug</option>
</select></td>
My php looks like this:
$cat = array(
'CAR_TIR' => array('comp' => 'Tires','price' => 100),
'CAR_OIL' => array('comp' => 'Oil', 'price' => 10),
'CAR_SPK' => array('comp' => 'Spark Plug', 'price' => 4),
'VAN_TIR' => array('comp' => 'Tires','price' => 120),
'VAN_OIL' => array('comp' => 'Oil', 'price' =>12),
'VAN_SPK' => array('comp' => 'Spark Plug', 'price' =>5),
'TRK_TIR' => array('comp' => 'Tires','price' => 150),
'TRK_OIL' => array('comp' => 'OIL','price' => 15),
'TRK_SPK' => array('comp' => 'Tires','price' => 6),
);
echo $cat[$_POST['type'].'_'.$_POST['component']]['price'];
?>
and the output that i am getting looks like this : Price checkup? array('comp' => 'Tires','price' => 100), 'CAR_OIL' => array('comp' => 'Oil', 'price' => 10), 'CAR_SPK' => array('comp' => 'Spark Plug', 'price' => 4), 'VAN_TIR' => array('comp' => 'Tires','price' => 120), 'VAN_OIL' => array('comp' => 'Oil', 'price' =>12), 'VAN_SPK' => array('comp' => 'Spark Plug', 'price' =>5), 'TRK_TIR' => array('comp' => 'Tires','price' => 150), 'TRK_OIL' => array('comp' => 'OIL','price' => 15), 'TRK_SPK' => array('comp' => 'Tires','price' => 6), ); echo $cat[$POST['type'].''.$_POST['component']]['price']; ?>
so literally that is the output. please let me know what i could do. thanks!