Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Location
    Leicester, United Kingdom
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need A Cost Calculator Coding

    Breif Description:
    Hello, I'm about to start work with a client and they would like a cost calculator on there website. What I mean by this is, it has a form, where by the person viewing the website can choose between two different times of the year (which has a seperate basic rate) then a calculation is done by the script of how many miles between the UK Postal Codes imputted into the form (there will be 3 postcode inputs on the form)

    Detailed Description:
    I'm about to start work with a client who owns a classic car, and is looking to do wedding car hire. What they would like to do is have a 2 basic rates which is selectable from a List Menu. One being between April & October, the other being between November & March.

    Once one of the options is selected, it then has a basic cost stored prusumablely in a variable. (I dont know, just an idea, if you have a better way, please do surguest it) then I need to be able to have 3 different inputs for the postal code and the script works out how many miles the journey will be, charged at a rate per mile on top of the basic cost.

    The form should look a little bit like this I should imagine (like I said earlier, I'm open to surguestions)

    Code:
    <form id="form1" name="form1" method="post" action="">
      <p>
        <label>
          Date of Car Hire
          <select name="select" id="select">
            <option value="Please Select" selected="selected">Please Select</option>
            <option value="April to October">April to October</option>
            <option value="November to March">November to March</option>
          </select>
        </label>
      </p>
      <p>Initial Pickup Postcode: 
          <input type="text" name="initialPostcode" id="initialPostcode" />
      </p>
      <p>Church Postcode: 
        <label>
          <input type="text" name="churchPostcode" id="churchPostcode" />
        </label>
      </p>
      <p>Reception / Venue Postcode:</p>
        <label>
          <input type="submit" name="button" id="button" value="Submit" />
        </label>
    </form>
    I understand this is going to be quite a complex script and was wondering how much it would cost me.

    If you could reply to the thread and if I belive your responce is a serious responce then I will private message you my E-Mail, if you want to private message to discuss this also please feel free to do so! I hope I have explained everything clearly enough for you, if I haven't and you ahve any queries please ask.

  • #2
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    Interesting idea. I'm not familiar with UK postal codes, but to calculate distance, you'd need to know the latitude and longitude for the postal code, which might be tricky.

    An alternative might be to use the google Maps API and ask for a specific address, then you could calculate a better distance (and even have the API give you actual driving distance).

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Do you care if the page reloads or are you wanting to avoid a page refresh? What language do you need this done in? I'm assuming php?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Regular Coder
    Join Date
    Apr 2009
    Posts
    244
    Thanks
    1
    Thanked 20 Times in 20 Posts
    Yes, this sounds like an interesting project. I would definitely rely on something like Google API to achieve this, taking into consideration the actual roads, rather than calculating the spherical distance by brute force (Haversine formula, is it?)

    Mike

  • #5
    New Coder
    Join Date
    Mar 2009
    Posts
    68
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bcarl314 View Post
    Interesting idea. I'm not familiar with UK postal codes, but to calculate distance, you'd need to know the latitude and longitude for the postal code, which might be tricky.

    An alternative might be to use the google Maps API and ask for a specific address, then you could calculate a better distance (and even have the API give you actual driving distance).
    Correct. You need lat/long as there is no freely available database or API of any sort for UK postal codes.

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The distance the google api will use would be the center of whatever post code you give it so it would be just an estimate.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •