Jump to content

Radio buttons Delivery cost help


barrycorrigan

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.