Thank you that post the minerals i want but it also posts the minerals for every ore type. When the person makes a selection of Omber or Arkonor or something I would like it to just post the minerals for that type. So you can see what im doing to maybe understand it you can go to http://www.ascensionscorp.com/refining.php and here is the code to the page.
And again the batch is not being grabbed probably my being stupid im still trying to learn php i really like it so plz forgive me. I have notes in the code to explain my problem areas.
[php]
Ore/Refining Yield Calculator
<?php
function get_batch( $ore, $list ) {
$batch = isset( $list[$ore]['batch'] ) ? $list[$ore]['batch'] : false;
return $batch;
}
$batch = get_batch( "Arkonor", $type_ore );
//I would like to grab batch for every kind of ore type that would be selected
$type_ore = array(
"Arkonor" => array(
"Megacyte" => 333,
"Tritanium" => 300,
"Zydrine" => 166,
"batch" => 250
),
"Bistot" => array(
"Megacyte" => 170,
"Pyerite" => 170,
"Zydrine" => 341,
"batch" => 200
)
);
$ore_qual = array('+0%' => 0, '+5%' => 0.05, '+10%' => 0.10);
$s_equip = array('75%' => 0.75, '50%' => 0.5, '40%' => 0.4, '35%' => 0.35, '32%' => 0.32, '30%' => 0.30);
$refine_sk = array('Level 0' => 0, 'Level 1' => 1, 'Level 2' => 2, 'Level 3' => 3, 'Level 4'=> 4, 'Level 5' => 5);
$ref_eff_sk = array('Level 0'=> 0, 'Level 1' => 1, 'Level 2' => 2, 'Level 3' => 3, 'Level 4'=> 4, 'Level 5' => 5);
$ore_pro_sk = array('Level 0'=> 0, 'Level 1' => 1, 'Level 2' => 2, 'Level 3' => 3, 'Level 4'=> 4, 'Level 5' => 5);
//Here is where the batch is calculated and then posted in a table to display the values
$quant = !empty($_POST['quant']) ? $_POST['quant'] : '';
$refine = floor($quant / $batch);
$unref = $quant - ( $refine * $batch );
$total = number_format((($_POST['s_equip'] + 0.375 * ( 1 + $_POST['refine_sk'] * 0.02 ) * ( 1 + $_POST['ref_eff_sk'] * 0.04 ) * ( 1 + $_POST['ore_pro_sk'] *
0.05)) * 100 ), 2, '.', '');
?>
Ore/Refining Yield Calculator
Ore Type: |
<?php
// Also right here for some reason it has stopped keeping the value when you calculate the page was wondering if you could explain why and how to fix
foreach($type_ore as $key => $value){
echo ''.$key.'';
} ?> |
Station Equipment: |
<?php
foreach($s_equip as $key => $value){
echo ''.$key.'';
} ?> |
Mineral Info: Perfect
<?php
//Here is where it post all the minerals for every ore type, only want to post minerals for the selected ore.
foreach( $type_ore as $name => $ore ) {
foreach( $ore as $type => $value ) {
if( $type == "batch" ) continue;
echo "$type for $name is $value <br />";
}
}
?>
|
Ore Quality: |
<?php
foreach($ore_qual as $key => $value){
echo ''.$key.'';
} ?> |
Refining Skill: |
<?php
foreach($refine_sk as $key => $value){
echo ''.$key.'';
} ?> |
Quantity: |
|
Refinery Efficiency Skill: |
<?php
foreach($ref_eff_sk as $key => $value){
echo ''.$key.'';
} ?> |
Units: |
m3: |
Ore Processing Skill: |
<?php
foreach($ore_pro_sk as $key => $value){
echo ''.$key.'';
} ?> |
ISK/unit: |
|
Total Yield: |
<?php
if ($total>=100)
echo "100.00";
else
echo $total;
?>% |
Ore Information
|
Batch Size:
<?php
echo $batch;
?>
|
Unrefined:
<?php
echo $unref;
?>(Units)
|
Refines:
<?php
echo $refine;
?>
|
|
[/php]