the top option option in a selected list is being loaded as one of the dynamic drop down options

I have a dynamic drop down menu which is hooked up to a query_string to send to the next screen, how can I validate the information from the drop down menu before it gets sent to the next page? I just don't know how to indentify the dynamic drop down. Thanks again!! This is through the server also. here is the code I have so far.

<tr><td id="giftCardSelectTd">Choose a Gift Card</td></tr><tr><td id="two"> <select name="productId" id="input1">
    <option value="0">Select Card</option><? while($rows=mysql_fetch_array($result)) {$productId=$rows['productId'];$productPrice=$rows['price'];if($productId == '0'){
    $error="Please select a Gift Card."; header('Location: convenientgiftcardpage.php');}if($productPrice < 0){
    $anchor='<td><a id="addtocartbtn" href="convenientcartpage.php?add='. $productId . '">Add to Cart</a></td>';
}
else{
    $anchor='<td><a id="addtocartbtn" href="convenientcartpage.php?add='. $productId . '">Add to Cart</a></td>';
}

    ?>
    <option value="<?php echo $productId;?>">$<?=number_format($productPrice,2);?></option>
    <? } ?></select></td><?php echo $anchor;?>

    </tr>

Answers


<form name="myform" method="POST" action="" >

<select name="productId" id="input1"> 
<option value="Select Card">Select Card</option>

<?php while($rows=mysql_fetch_array($result)) {
   $productId=$rows['productId'];$productPrice=$rows['price'];
   if ($productPrice < 0) { 
      $anchor='<td><a id="addtocartbtn" href="convenientcartpage.php?add='. $productId . '">Add to Cart</a></td>'; } 
   else {
      $anchor='<td><a id="addtocartbtn" href="convenientcartpage.php?add='. $productId . '">Add to Cart</a></td>';
   }
?> 

<option value="<?php echo $productId;?>">$<?=number_format($productPrice,2);?>
</option> <?php } ?>
</select></td>

<input type="submit" value="Continue" class="btn"/>

<?//php echo $anchor;?>
</form>

<?php
   if((strcmp($_SERVER['REQUEST_METHOD'],'POST')==0) {
      $products = $_POST["productId"] ;
      // validate it
      if (everything is fine) {
         header("location:".$anchor)
      }
   }
?>

Hope this helps


Thanks for the help but I figured it out! When I put the code in a form with method GET then I can send the drop down list value to the shopping cart with a Select name"" that isset on the cart page of code. Thanks again for all your help. P.S. I tried to put the code in the original post of the question and it didn't work out


Need Your Help

Is it a missing implementation with JPA implementation of hibernate?

java hibernate orm jpa

On my way in understanding the transaction-type attribute of persistence.xml, i came across an issue / discrepency between hibernate-core and JPA-hibernate which looks weird.