joshluv33 Posted July 17, 2008 Share Posted July 17, 2008 I created a drop down list from my db which shows a product and the option value is the price associated with that product. I need to have the price value passed to a different page which will add it to some other values to create a total price. Here is the code from the select list: <?php $printtype_result = mysql_query("SELECT id,name,price,quan_avail,bypass FROM prints where quan_avail > 0 order by porder", $db); $printtype_rows = mysql_num_rows($printtype_result); $printtype = mysql_fetch_object($printtype_result); ?> <?PHP echo "<tr><td class=\"photo_details\" bgcolor=\"#F9F9F9\" style=\"border: 1px solid #eeeeee; padding: 10px;\">"; echo "<div align=\"center\" style=\"background-color: #eeeeee; margin-bottom: 10px; padding: 3px;\"><b>".$details_po_purchase_title."</b></div>"; ?> <select name="printprice" style="width:500px;"> <option value=""><?PHP echo $detail_po_select; ?></option> <?php do { ?> <option value="<?php $printtype->price; ?>"><? echo $printtype->name . " - (" . $currency->sign . $printtype->price; ?>)</option> <?php } while($printtype = mysql_fetch_object($printtype_result))?> </select> This list is part of a larger form: <form name="po_order" method="post" action="public_actions.php?pmode=add_cart"> This is from the action page: $printprice = mysql_real_escape_string($_POST['printprice']); after $printprice is captured then it is added to some other values to give a grand total: $grandrm = $price + $po_price + $printprice; I would appreciate any help in retrieving this part of the form data on the action page. Link to comment https://forums.phpfreaks.com/topic/115254-solved-pass-select-list-value-via-post-problems/ Share on other sites More sharing options...
GingerRobot Posted July 17, 2008 Share Posted July 17, 2008 You need to give your options a value. It is that which is passed via POST, not the text shown in the drop down box. Link to comment https://forums.phpfreaks.com/topic/115254-solved-pass-select-list-value-via-post-problems/#findComment-592518 Share on other sites More sharing options...
joshluv33 Posted July 17, 2008 Author Share Posted July 17, 2008 The option does have a value. <option value="<?php $printtype->price; ?>"> Link to comment https://forums.phpfreaks.com/topic/115254-solved-pass-select-list-value-via-post-problems/#findComment-592635 Share on other sites More sharing options...
joshluv33 Posted July 17, 2008 Author Share Posted July 17, 2008 I found the problem, it should be: <option value="<?php echo $printtype->price; ?>"> not <option value="<?php $printtype->price; ?>"> Thanks. Link to comment https://forums.phpfreaks.com/topic/115254-solved-pass-select-list-value-via-post-problems/#findComment-592638 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.