Jump to content

Dynamic drop down in Dreamweaver - time crunch


Recommended Posts

I have populated a dropdown list in Dreamweaver, which loads fine, but it is passing the first item of the list, not the selected one. Not sure why?  ??? In a time crunch, Thanks for any help! 

 

<? 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 />
      Update Product </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" />  
	</form>
    </td>
   </tr>
</table>  
<?php
mysql_free_result($rsSKU);
?>

Link to comment
Share on other sites

  • 4 weeks later...

Perhaps few questions from your code will help you to reach to your solution.

 

1) Why action="updateProducts.php?ProductNo=<?php echo $row_rsSKU['SKU']; ?> has ProductNo=<?php..... has been hardcoded. It will always be the first value passed to updateProducts.php page. Remove this parameter

 

2) If you are examining values at address bar, note your form action is set to POST. If updateProducts.php is extracting value using GET method, set the method to GET.

 

3) While populating your select Menu, you have chosen "Select value equal to" and the $row_rsSKU['SKU'], thats why its comparing values <?php if (!(strcmp($row_rsSKU['SKU' .... (remove that).

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.