dynamic dropdown list not passing selection
Posted: Thu Dec 06, 2007 12:45 pm
I have a dynamic dropdown list that passes the first item in the list, not the selected. I have tried so many things. I would greatly appreciate help. I have posted on serveral forums. here it the code:
I have tried passing $_POST['skuList'] everything I can think of and it still passes the first item. Again I thanking you in advance for help! I have been working on this for a LONG time and just can't see my error. 
Code: Select all
<? mysql_select_db($database_connJDD, $connJDD);
$query_rsSKU = "SELECT products.SKU FROM products";
$rsSKU = mysql_query($query_rsSKU, $connJDD) or die(mysql_error());
$row_rsSKU = mysql_fetch_assoc($rsSKU);
$totalRows_rsSKU = mysql_num_rows($rsSKU);
?>
<table align="center">
<tr>
<td>
<p align="center">Select SKU for <br />
Product Update </p>
<form id="form5" name="form5" method="post" action="updateProducts.php?ProductNo=<?php echo $row_rsSKU['SKU']; ?>">
<select name="skuList">
<?php
do {
?>
<option value="<?php echo $row_rsSKU['SKU']?>"<?php if (!(strcmp($row_rsSKU['SKU'], $row_rsSKU['SKU']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsSKU['SKU']?></option>
<?php
} while ($row_rsSKU = mysql_fetch_assoc($rsSKU));
$rows = mysql_num_rows($rsSKU);
if($rows > 0) {
mysql_data_seek($rsSKU, 0);
$row_rsSKU = mysql_fetch_assoc($rsSKU);
}
?>
</select> <br />
<input name="Update" type="submit" value="Update Product" />
</form>
</td>
</tr>
</table>
<?php
mysql_free_result($rsSKU);
?>