Thread: drop down lists

    #1
  1. No Profile Picture
    drosen
    Guest
    Devshed Newbie (0 - 499 posts)
    I am interested in having two drop down lists on a page so a person can select a country from each list, click submit, and a phone rate will be automatically calculated and displayed for the user.

    Any help would be completely appreciated.

    - Damien

    ------------------
    www.international01.com
  2. #2
  3. No Profile Picture
    christine
    Guest
    Devshed Newbie (0 - 499 posts)
    I've used this script, to do a similar calculation, and I think it'll do for you.

    <HTML>
    <HEAD>
    <SCRIPT LANGUAGE="JavaScript">
    <!--hide code from old browsers
    function get_rate ()
    {
    if (document.rates.from.options[document.rates.from.selectedIndex].value !="none")
    {
    if (document.rates.to.options[document.rates.to.selectedIndex].value !="none")
    {
    var rate_from = eval(document.rates.from.options[document.rates.from.selectedIndex].value);
    var rate_to = eval(document.rates.to.options[document.rates.to.selectedIndex].value);
    var rate = eval(rate_from + rate_to);
    alert("Call costs $"+rate+" per minute");
    }
    else
    {
    alert("Please select countries.");
    }
    }
    else
    {
    alert("Please select countries.");
    }
    }
    //end hiding-->
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM NAME="rates">
    <SELECT NAME="from" SIZE="1">
    <OPTION VALUE="none">calling from
    <OPTION VALUE="0.10">country 1
    <OPTION VALUE="0.20">country 2
    <OPTION VALUE="0.30">country 3
    <OPTION VALUE="0.40">country 4
    </SELECT>
    <SELECT NAME="to" SIZE="1">
    <OPTION VALUE="none">calling to
    <OPTION VALUE="0.10">country 1
    <OPTION VALUE="0.20">country 2
    <OPTION VALUE="0.30">country 3
    <OPTION VALUE="0.40">country 4
    </SELECT>
    <BR>
    <INPUT TYPE="button" VALUE="calculate rate" onClick="get_rate()">
    </FORM>
    </BODY>
    </HTML>

    Hope it helps.
    Christine.

Similar Threads

  1. MySQL output to table using phpBB
    By CCCMTech in forum PHP Development
    Replies: 0
    Last Post: February 2nd, 2004, 02:43 PM
  2. Replies: 4
    Last Post: February 18th, 2002, 06:08 AM
  3. repopulating drop down lists on condition
    By trops in forum PHP Development
    Replies: 13
    Last Post: June 25th, 2001, 07:56 PM
  4. dynamic drop down lists (here's what i get):
    By Andyd in forum HTML Programming
    Replies: 0
    Last Post: May 12th, 1999, 08:42 AM

IMN logo majestic logo threadwatch logo seochat tools logo