Pankirk
Aug 10th, 2008, 09:14 PM
So, I have a script that will allow users to post their account items onto a database where other users can post their items/ game currency onto the trade..... I'm sure it was hard to understand any of that, it's hard to explain. Anyway, the page where you put your items to trade is a page where i have a checkbox generated for each item you have. For example:
while($itemname = $getinvitemsres->fetch_assoc())
{
$id = $itemname['item_id'];
$user_ownid = $itemname['id'];
$getiteminfoagain = "select * from items where id = '".$id."'";
$getinfoagainres = $db->query($getiteminfoagain);
while($infoirem = $getinfoagainres->fetch_assoc())
{
$itemnamelol = $infoirem ['name'];
$itemidid = $infoirem ['id'];
$description = $infoirem['description'];
$rarity = $infoirem['rarity'];
$otheringo = $infoirem['other'];
$image = $infoirem['image'];
echo "<tr>
<td width='15%' align='center' valign='middle' style='border: 1px solid #CCCCCC;'><input type='checkbox' name='UNKNOWN' value='$itemnamelol'></td>
<td width='85%' valign='middle' style='border: 1px solid #CCCCCC;'><img src='/images/items/$image' width='85' height='85' alt='$description'>
$itemnamelol - <font color='green'>$rarity</font> <font color='orange'>$otheringo</font></td>
</tr>";
}
}
echo "</table><input type='submit' value='Create trade!' name='submit' /></form></center>";
that code gets all of the users items from their item table and puts them next to a check box. if you check the checkbox that item will be up for trading... ect. But, the problem i'm having is: since its unknown what the item is or what the value of the checkbox will be (its based on what the user has in their inventory) how can I get the value of the checkbox into an array (an array because it needs to be different for each of the items checked) and then I wull be able to use that array to continue on with the trading... If this doesnt make sense then please tell me so I can revise my post. Thank you so much in advance this helps a lot!
while($itemname = $getinvitemsres->fetch_assoc())
{
$id = $itemname['item_id'];
$user_ownid = $itemname['id'];
$getiteminfoagain = "select * from items where id = '".$id."'";
$getinfoagainres = $db->query($getiteminfoagain);
while($infoirem = $getinfoagainres->fetch_assoc())
{
$itemnamelol = $infoirem ['name'];
$itemidid = $infoirem ['id'];
$description = $infoirem['description'];
$rarity = $infoirem['rarity'];
$otheringo = $infoirem['other'];
$image = $infoirem['image'];
echo "<tr>
<td width='15%' align='center' valign='middle' style='border: 1px solid #CCCCCC;'><input type='checkbox' name='UNKNOWN' value='$itemnamelol'></td>
<td width='85%' valign='middle' style='border: 1px solid #CCCCCC;'><img src='/images/items/$image' width='85' height='85' alt='$description'>
$itemnamelol - <font color='green'>$rarity</font> <font color='orange'>$otheringo</font></td>
</tr>";
}
}
echo "</table><input type='submit' value='Create trade!' name='submit' /></form></center>";
that code gets all of the users items from their item table and puts them next to a check box. if you check the checkbox that item will be up for trading... ect. But, the problem i'm having is: since its unknown what the item is or what the value of the checkbox will be (its based on what the user has in their inventory) how can I get the value of the checkbox into an array (an array because it needs to be different for each of the items checked) and then I wull be able to use that array to continue on with the trading... If this doesnt make sense then please tell me so I can revise my post. Thank you so much in advance this helps a lot!