PDA

View Full Version : Clickable variables



hallsofvallhalla
08-05-2008, 02:43 PM
Hello everyone, sweet forums, quick question.

I have a table on a database of say items. Its a inventory.


<?php
echo "<big>Weapons For Sale</big>";
$getgoods="SELECT * from equipment where type = 'Weapon' order by Price";
$getgoods2=mysql_query($getgoods) or die("Could not fetch Weapons");
print "<table border='4' bordercolor='black' bgcolor='white'>";
print "<tr><td>Name</td><td>Type</td><td>Rating</td><td>Speed</td><td>Amount Available</td><td>Price</td></tr>";
while($getgoods3=mysql_fetch_array($getgoods2))
{
print "<tr><td>$getgoods3[Name]</td><td>$getgoods3[Type]</td><td>$getgoods3[Rating]</td><td>$getgoods3[Speed]</td><td>$getgoods3[amountavail]</td><td>$getgoods3[Price]</td></tr>";
}
print "</table>";
?>

This just basically lists all the weapons in the table.
ok now i want the player to be able to select a weapon by simply clicking on the name. It could then pass the variable to another page where it asks are you sure you want to buy this weapon, blah blah.

Thanks for any help.

Jesdisciple
08-05-2008, 09:38 PM
What have you tried? How did it not work?

I would make another cell in that table-row and put a "Buy" link with an href of "buy.php?item=$id" or the equivalent.

hallsofvallhalla
08-05-2008, 10:29 PM
wow good idea. I was initially trying to just make the name of the item as a link but i didnt know how to make the name a link in the array.

Thanks!