dardime Posted August 15, 2017 Share Posted August 15, 2017 (edited) Hi i need help on subtracting a value stored on mysql row using radio buttons in php. Only if you select NO it will deduct 5. Thank you Please find screenshot. Thanks Edited August 15, 2017 by dardime Quote Link to comment Share on other sites More sharing options...
benanamen Posted August 15, 2017 Share Posted August 15, 2017 What have you tried? Quote Link to comment Share on other sites More sharing options...
dardime Posted August 15, 2017 Author Share Posted August 15, 2017 Hi I have tried using an if statement condition: <?php if($_SESSION['power']=='No' && $_SESSION['display']=='No' && $_SESSION['liquid']=='Yes' && $_SESSION['buttons']=='Yes' && $_SESSION['enclosure']=='Yes') {?> <div class="pricefont"><b>$<?php echo $result["price3d"]; ?></b></div> Quoted Price<br><br> <?php } ?> And i have these values stored in price, price2d, price3d, price4d, price5d amd whatever the condition met it outputs the value in row. It will show the value but i don't know how to insert this value to database as its only a result. If it can be then it will solve my problem. Please find screenshot Quote Link to comment Share on other sites More sharing options...
dardime Posted August 15, 2017 Author Share Posted August 15, 2017 Hi All Thank you i have sorted this out. Thanks heaps! Quote Link to comment Share on other sites More sharing options...
dardime Posted August 15, 2017 Author Share Posted August 15, 2017 (edited) <?php if($_SESSION['power']=='No' && $_SESSION['display']=='No' && $_SESSION['liquid']=='Yes' && $_SESSION['buttons']=='Yes' && $_SESSION['enclosure']=='Yes') { $quotedprice = $result["price3d"]; } ?> Edited August 15, 2017 by dardime Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 15, 2017 Share Posted August 15, 2017 I have absolutely no idea what you're doing there. Are you manually going through all 32 possible cases? Quote Link to comment Share on other sites More sharing options...
dardime Posted August 15, 2017 Author Share Posted August 15, 2017 Any solutions from you please? Yes i have to add each cases.... Quote Link to comment Share on other sites More sharing options...
Jacques1 Posted August 15, 2017 Share Posted August 15, 2017 So how does the calculation work exactly? You start with a base price, and each defect reduces it by 5.00? Then simply count the “No” selections. price = base_price − defect_count × 5.00 Note that with some of your example data, the result will be 0.00 if all selections are “No”. 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.