barrycorrigan Posted February 10, 2011 Share Posted February 10, 2011 Hi, I was wondering if someone could help me a little. I have just completed a order form + a simple calculator that lets the user complete a simple order that sends to an email. My problem I have some radio buttons saying would you like your order delivered. I want to be able that if the user clicks no. The delivery cost will stay 0.00 but if they click yes the script will carry on as normal. my code to calculate the delivery cost is this: Final = Totamt - Discount; document.ofrm.final.value = dm(eval(Final)); //Code for Delivery Charges if ( Final <= 99 ) { Delivery = 7.95; document.ofrm.delivery.value = dm(eval(Delivery)); } else if ( Final >= 100 && Final <= 349 ) { Delivery = 11.95; document.ofrm.delivery.value = dm(eval(Delivery)); } else if ( Final >= 350 ) { Delivery = 0; document.ofrm.delivery.value = dm(eval(Delivery)); } else { Delivery = 7.95; document.ofrm.delivery.value = dm(eval(Delivery)); } Grand = Final + Delivery; document.ofrm.grand.value = dm(eval(Grand)); My radio buttons are this <fieldset id="subscribe"> <legend>Would you like your order delivered</legend> <div class="row2"> <label for="subscribe-yes" style="float:none!important; margin-left:10px;">Yes</label> <input style="width:20px!important; margin-right:15px;" name="subscribe" type="radio" value="Yes" id="subscribe-yes" <?php $OK = isset($_POST['subscribe']) ? true : false; if ($OK && isset($missing) && $_POST['subscribe'] == 'Yes') { ?> checked="checked" <?php } ?> /> <label for="subscribe-no" style="float:none!important;">No</label> <input style="width:20px!important;" name="subscribe" type="radio" value="No" id="subscribe-no" <?php if ($OK && isset($missing) && $_POST['subscribe'] == 'No') { ?> checked="checked" <?php } ?> /> </div> </fieldset> The PHP makes the radio buttons submit to a email which is irrelevant to this post. I would really appreciate some help on this or a point in the right direction. Regards barry Quote Link to comment Share on other sites More sharing options...
sunfighter Posted February 11, 2011 Share Posted February 11, 2011 wrap your code for delivery charges in an if statement. Try if(document.getElementById('subscribe-yes').checked == true){ your code} Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted February 11, 2011 Share Posted February 11, 2011 I'm wondering why you're using eval() everywhere. Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 12, 2011 Share Posted February 12, 2011 I'm wondering why you're using eval() everywhere. Yeah, I asked the same thing on a previous post of his. And instructed that it is not doing what he thinks it is doing and that he should remove it. I think he may be one of those people that likes to ask for help but then never actually listens. 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.