hi,
I recently started php and mysql and im enjoying it. I used this page and others a lot when i had a problem.
Now i ran into a problem that isnt so easy to find an solution to. I read the forums and tried almost everything i could think of.
here is the thing:
I made a page that has about 10 drop down menus on it.. all 10 are filled with info from a database. I used an Array to set the Names of the dropdown menus. This all is working fine, when I press the submit button it changes the page and sets the variables of the page in the adres bar.
now the second page is suppose to read the variables and get info from the same database on the record with that name. so thats 10 records. problem is: I use an array to set the names again and now i cant get the value of the variable. Is there a way to by pass this, I seen entries with things like $$variable but this isnt working for me
little source is:
for ($G= 1; $G < 11; $G++){
$typename = array("1"=>"necklace", "2"=>"helms", "3"=>"shirt", "4"=>"bodyarmor", "5"=>"cloak", "6"=>"gloves", "7"=>"rings", "8"=>"shields", "9"=>"boots", "10"=>"belts");
if ($typename[$G] <> "") {
$choose=mysql_query("SELECT * FROM armor where name=\"$typename[$G]\"") or die(mysql_error());
$armorstats = mysql_fetch_object($choose);
$ac = $armorstats->ac;
print "<div align=\"right\"><strong>$armorstats->name give $ac defence</strong></div>";
$image = $armorstats->imagepath;
print "<div class=\"$typename[$G]\">$image</div>\r\n";
$actotal= $actotal + $ac;
}
$total = $actotal + 10;
}
I need to get the value of example $typename[$g] = $typename[1] = necklace. but if I use $$ function i just get an error... please gimme hand, Thank u