Form calculations

Discussion in 'PHP' started by Lucy, Apr 17, 2007.

  1. #1
    Hi,

    I've designed a form that contains some radio buttons and checkboxes. For instance,


    <p>Size:<br />
    <input type="radio" id="sml" name="size" value="Small" /></label for="sml">Small</label><br />
    <input type="radio" id="med" name="size" value="Medium" /></label for="med">Medium</label><br />
    <input type="radio" id="lge" name="size" value="Large" /></label for="lge">Large</label><br /></p>

    <p>Colours:<br />
    <input type="checkbox" id="green" name="hat[]" value="Green" /><label for="green">Green</label><br />
    <input type="checkbox" id="red" name="hat[]" value="Red" /><label for="red">Red</label><br />
    </p>

    Does anyone know how I can assign a dollar value to different options. So that if options are chosen it will calculate the price.

    For instance a small, red hat would equal different price to a large, green hat.

    Any guidance would be appreciated I can't find anything anywhere on this topic and I'm so lost.
     
    Lucy, Apr 17, 2007 IP
  2. Subikar

    Subikar Active Member

    Messages:
    241
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #2
    ok it is easy just assigned the dollar value in value="$Amount"

    Lemme explain you more clearly:

    <input type="radio" id="sml" name="size" value="$Amount" onclick="javascript:Calculate(this);"/>

    And now in javascript calculate function do your calculation and display it.

    Any more help needed I am always here to help you.
     
    Subikar, Apr 17, 2007 IP