joshluv33 Posted August 15, 2006 Share Posted August 15, 2006 I am working with existing php code for my photography site which generates two drop down lists. The code retrieves Mysql info for both the size of print the client wants and separately for the color choice of the photo. Each table in Mysql has a price associated with the product. I would like the client to choose both options and have the sum totaled before it is sent to the cart. Let me show you where I am at now with the code. I appreciate any help... Quote Link to comment Share on other sites More sharing options...
joshluv33 Posted August 15, 2006 Author Share Posted August 15, 2006 I've attached the code. Again I appreciate any help with this.[code] function addprice(str) { var itemLoc,itemLocLink; itemLoc=document.getElementById('add2cart'); itemLoc.href=itemLoc.href + str.value; itemLocLink=document.getElementById('add2cartlink'); itemLocLink.href=itemLocLink.href + str.value; } </script> <? echo "<tr><td class=\"photo_details\" bgcolor=\"#000000\" style=\"border: 1px solid #eeeeee; padding: 5px;\">";echo "<div align=\"center\" style=\"background-color: #000000; margin-bottom: 10px; padding: 3px;\"><b>Order Prints</b></div>";$x = 1;$print_result = mysql_query("SELECT * FROM prints where quan_avail > 0 order by 'porder'", $db);$print_rows = mysql_num_rows($print_result);echo "<select name='prints' onChange='addprice(this);'>";echo "<option>Select Prints</option>";while($print=mysql_fetch_assoc($print_result)){$name = $print['name'];$price = $print['price'];$id = $print['id'];echo "<option value='$id'>$name--->$$price</option>\n";}echo "</select>";if($print->quan_avail != "999"){ echo "<br />" . $print->quan_avail;} echo "</font><br>";?><? $x = 1;$color_result = mysql_query("SELECT * FROM color", $db);$color_rows = mysql_num_rows($color_result);echo "<select name='color' onChange='addprice(this);'>";echo "<option>Select Color</option>";while($color=mysql_fetch_assoc($color_result)){ $name = $color['name']; $price = $color['price'];echo "<option value='$price'>$name--->$$price</option>\n"}echo "</select>";if($print->quan_avail != "999"){ echo "<br />" . $print->quan_avail;}echo "</font><br>"; ?> <span style="float: center"><a id="add2cart" href="public_actions.php?pmode=add_cart&ptype=p&gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$_GET['pid'];?>&prid=<?=$print->id;?>" class="photo_links"><img src="images/cart.gif" valign="middle" border="0" /></a> <a id="add2cartlink" href="public_actions.php?pmode=add_cart&ptype=p&gid=<?=$_GET['gid'];?>&sgid=<?=$_GET['sgid'];?>&pid=<?=$_GET['pid'];?>&prid=" class="photo_links">Add To Cart</a></span>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.