Coupon option list
My Client wants to have a drop down list for Coupons that can be selectes in the shopping cart. I made a new recordset called PowerStoreCoupons and have added an option field in place of the text field. However, the list is only being populated with the first record.
index.php
I have tried this out on a blank page and it works ok, but is not working on cart.php page. Can anyone see what I have wrong here?
Thanks so much,
Ken
Recordset:
mysql_select_db($database_PowerStoreConnection, $PowerStoreConnection);
$query_PowerStoreCoupons = "SELECT ps3_coupons.CouponID, ps3_coupons.CouponCode, ps3_coupons.CouponIsLive FROM ps3_coupons WHERE ps3_coupons.CouponIsLive = 1 ORDER BY ps3_coupons.CouponCode";
$PowerStoreCoupons = mysql_query($query_PowerStoreCoupons, $PowerStoreConnection) or die(mysql_error());
$row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons);
$totalRows_PowerStoreCoupons = mysql_num_rows($PowerStoreCoupons);
<span style="float:left"><h2>Coupon Code:
<select name="CID" id="CID">
<?php
do {
?>
<option value="<?php echo $row_PowerStoreCoupons['CouponCode']?>"<?php if (!(strcmp($row_PowerStoreCoupons['CouponCode'], $row_PowerStoreCoupons['CouponCode']))) {echo "selected=\"selected\"";} ?>><?php echo $row_PowerStoreCoupons['CouponCode']?></option>
<?php
} while ($row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons));
$rows = mysql_num_rows($PowerStoreCoupons);
if($rows > 0) {
mysql_data_seek($PowerStoreCoupons, 0);
$row_PowerStoreCoupons = mysql_fetch_assoc($PowerStoreCoupons);
}
?>
</select>
</h2>
</span>