First post
As you will soon realize, I'm not a php pro. I'm pretty novice but I'm trying to learn. I've watched a lot of youtube videos and have a book ("PHP and MySQL for Dynamic Websites"). But honestly the videos help a lot more
Anyway here is my problem I hope you can help me with. There is this game I used to play a lot and haven't really anymore but I want to make a help site for it because there isn't one and I think it could be a big hit (maybe get some ad money off it *wink* *wink*). And the first thing I wanted to make was a crafting calculator. Simply pick the the item you are wanting to craft from a drop down list, type in the quantity, and hit "Calculate". I started simple with an item that only has one material required (stronger weapons and armors have 15-20 materials needed). And this is how I went about doing it. After watching several array tutorials I made an array with two weapons, bamboo sword and bamboo spear.
Code: Select all
$item = array('Bamboo Sword' => $bamboo_sword , 'Bamboo Spear' => $bamboo_spear);Code: Select all
$bamboo_sword = array('bamboo' => 10);
$bamboo_spear = array('bamboo' => 10);
Code: Select all
$example_item = array('cowhide' => 50 , 'steal' => 15 , 'gold' => 5, etc.);
Code: Select all
<form action="luminary_materials_calculator_reciever.php" method="post";
<?php
$bamboo_sword = array('bamboo' => 10);
$bamboo_spear = array('bamboo' => 10);
$item = array('Bamboo Sword' => $bamboo_sword , 'Bamboo Spear' => $bamboo_spear);
echo '<select name="item_select">';
foreach($item as $key => $value)
{
echo "<option value=\"$key\">$key</option>";
}
echo '</select>';
echo '<input type="text" name="quantity" value="0" /><br />';
echo '<input type="submit" value="calculate" />';
?>
</form>
ex:
Copper 80
Iron Ore 40
Cowhide 70
etc.
This is as far as I got-
Code: Select all
<?php
echo $_POST["quantity"] * ... WHAT DO I DO?! ;
?>
MSN: fruzzgle@hotmail.com
AIM: fruzzgle
Email: fruzzgle@gmail.com
Thank you
BTW: the game is http://luminary.ijji.com
Just in case someone asks.