Encouraged by my find, I now try to have a select menu not show, if the recordset is empty.
The menu disappears just like it should, but when I put that item in the cart, the item no. is missing, the price is zero. Only the description and quantity is passed on.
This is the code for he select menu with show if:
<?php if (!empty($row_rssizedefault['size'])) { // Show if recordset not empty ?>
<select name="SelectSize" id="SelectSize" onchange="showprice()">
<?php
do {
?>
<option value="<?php echo $row_rssizedefault['size_id']?>"<?php if (!(strcmp($row_rssizedefault['size_id'], $row_rssize['size']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rssizedefault['size']?></option>
<?php
} while ($row_rssizedefault = mysql_fetch_assoc($rssizedefault));
$rows = mysql_num_rows($rssizedefault);
if($rows > 0) {
mysql_data_seek($rssizedefault, 0);
$row_rssizedefault = mysql_fetch_assoc($rssizedefault);
}
?>
</select>
<?php } // Show if recordset not empty ?>
The same happens, when I use this code as the first line instead:
<?php if (!empty($row_rssizedefault['size'])) { // Show if recordset not empty ?>
or <?php if ($totalRows_rssizedefault == 0) { // Show if recordset empty ?>
Does anyone know, what I have to change to make it work?