Avarian
Bring Out Your Dead!
I've never played with Arrays till now and it's not working so I could really use some help.
I'll make a small example so that I don't have to post my whole script. If this isn't helpful in pointing out what i'm doing wrong then i'll just post the actual script.
I'll make a small example so that I don't have to post my whole script. If this isn't helpful in pointing out what i'm doing wrong then i'll just post the actual script.
PHP:
// These are small example rays.
$creatures = array("rat"=>5,"cave rat"=>10);
$levels = array("1"=>0,"2"=>200,"3"=>400);
//Then there's a form to retrieve user input
$current_exp = $_POST['current_exp'];
$lvl_desired = $_POST['lvl_desired'];
$creature = $_POST['creature'];
//This variable is suppose take the user inputed lvl_desired and check it in the $levels array and then the exp from that level is the variable $lvlEXP_amount how ever this variable keeps returning blank
$lvlEXP_amount = $levels['$lvl_desired'];
// This variable figures out exp required to advance to the desired level.
$neededForAdvance = $lvlEXP_amount / $current_exp;
//This variable is suppose take the user inputed creature and check it in the $creatures array and then the exp from that creature is the variable $lcreatureEXP_amount how ever this variable keeps returning blank as well.
$creatureEXP_amount = $creatures['$creature'];
// This variable figures out how many of the user inputed creature needs to be killed to reach the lvl_desired.
$numberCreaturesToKill = $neededForAdvance / $creatureEXP_amount;