Display 1-50 in list menu
Posted: Thu May 13, 2010 5:10 am
[text]Hello there i am a newbie for php coding. [/text]
[text]As you see i have a list menu and i want to display the some numbers for the user to select as quantity . For example if i have 50as the total quantity i need to display 1 to 50 in the list menu with a for loop. Please help me. [/text]
Code: Select all
<?php
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("watch") or die(mysql_error());
$id=$_GET['id'];
$result = mysql_query("SELECT * From product Where Prod_ID='$id'")
or die(mysql_error());
while ($row = mysql_fetch_array ($result)) {
$qty=$row['Prod_Qty'];
echo "<table border=1> <tr> <td style=background-image:url(images/no_image.gif)> <img src=\"global.php?id=$id\"/></td>
<td align=left>
$row[Prod_Name]<br></td>
<td><select name=QTY>
<option value=0 selected=selected>Select Qty</option>
<option value=$qty>$qty</option>
</select> </td>
<td>$row[Prod_Price]</td>
<td></td></tr></table>";
}
?>