Page 1 of 1

how to use list/menu in selecting a database

Posted: Wed Oct 13, 2010 2:44 pm
by wags245
i really have a problem in selecting my database
i made a online purchasing and rendering service but i kind the got problem on selecting my stock this is my code

if ($_POST['GO']) {
switch($items) {
case 'tshirt':
$result = mysql_connect(Select * from tshirt);
while ($row = mysql_fetch_assoc($result)){
echo "<table>";
echo "<tr>";
echo "<td>";
echo "$row[stockID]";
echo "</td>";
echo "<td>";
echo "$row[itemQuality]";
echo "</td>";
echo "<td>";
echo "$row[ItemAmount]";
echo "</td>";
echo "<td>";
echo "$row[ItemPricet]";
echo "</td>";
echo "</tr>";
echo "</table>"
}
break;
case 'mugs':
$result = mysql_connect(Select * from mugs);
while ($row = mysql_fetch_assoc($result)){
echo "<table>";
echo "<tr>";
echo "<td>";
echo "$row[stockID]";
echo "</td>";
echo "<td>";
echo "$row[itemQuality]";
echo "</td>";
echo "<td>";
echo "$row[ItemAmount]";
echo "</td>";
echo "<td>";
echo "$row[ItemPricet]";
echo "</td>";
echo "</tr>";
echo "</table>"
}
break;
}

and here's my form

<form action="stocks.php" method="post">
<select name="item">
<option value="tshirt">Tshirt</option>
<option value="mugs">Mugs</option>
</select>
</form>