Hello All. I have started using PHP with Dreamweaver MX. However, i have a very unique question which i cannot seem to find a solution to anywhere on the internet. I know this will involve some sort of counter and a loop.
My question is I have an option menu dropdown box with a ticket quantity value that is popluated below in my code and would like it display multiple quantities of tickets depending on what inventory is on hand in the database with the condition that all tickets sold must be in "pairs". So for instance, if i had 8 tickets in the database table for xyz event then i would want my recordset to display 2,4,6,8 tickets in the dropdown box to be selected by the person for purchase since i am only selling pairs of tickets. Example: <option value=2>2</option><option value=4>4</option><option value=6>6</option><option value=8>8</option>
The results generated from the dropdown box must be incremented by 2 tickets up to the amount remaining in the database table.
I want this done dynamically. Below is the code which just displays "one" row of 8 tickets total from the option box using php/mysql. How do i display the above dynamically with the assumption that all tickets are purchased in pairs?
<td align="left" valign="middle" class="txtDarkReg"> <select name="qtytix" class="dropDownListFont">
<option value="" <?php if (!(strcmp("", $row_PreviewTix['TICKET_QTY']))) {echo "SELECTED";} ?>>Select
Qty</option>
<?php
do {
?>
<option value="<?php echo $row_PreviewTix['TICKET_QTY']?>"<?php if (!(strcmp($row_PreviewTix['TICKET_QTY'], $row_PreviewTix['TICKET_QTY']))) {echo "SELECTED";} ?>><?php echo $row_PreviewTix['TICKET_QTY']?></option>
<?php
} while ($row_PreviewTix = mysql_fetch_assoc($PreviewTix));
$rows = mysql_num_rows($PreviewTix);
if($rows > 0) {
mysql_data_seek($PreviewTix, 0);
$row_PreviewTix = mysql_fetch_assoc($PreviewTix);
}
?>
</select> </td>
Your help is appreciated
--Dig Dug