[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Form Calculations



Many thanks to the list members who helped me with the basics of setting
the execution permissions on my CGIs.

I have the following CGI.pm based CGI:

#!/usr/local/bin/perl

use CGI ':standard';

print header;
print start_html('A Simple Example'),
    h1('A Simple Example'),
    start_form,
    "What's your name? ",textfield('name'),
    p,
    "What's the combination?",
    p,
    checkbox_group(-name=>'words',
                   -values=>['eenie','meenie','minie','moe'],
                   -defaults=>['eenie','minie']),
    p,
    "How many items do you want? ",
    popup_menu(-name=>'quantity',
               -values=>['1','2','3','4','5','6','7'],

-labels=>{'1'=>'One','2'=>'Two','3'=>'Three','4'=>'Four',


'5'=>'Five','6'=>'Six','7'=>'Seven'}),


    "What Size?",
    popup_menu(-name=>'size',
               -values=>['100.00','200.00','300.00'],

-labels=>{'100.00'=>'Small','200.00'=>'Medium','300.00'=>'Large'
}),
    p,
    submit,
    end_form,
    hr;

if (param()) {
    print
        "Your name is: ",em(param('name')),
        p,
        "The keywords are: ",em(join(", ",param('words'))),
        p,
        "Your price for the above order is:
",em(param('quantity')*(param('size'))),
        hr;
}
print a({href=>'../cgi_docs.html'},'This is a broken link');

The calculation works great but I want to put a "$" sign after "Your price
for the above order is:"
the script is not happy with a "Your price for the above order is: $",em...
Probably something to do with the
fact that "$" is used for variables.

also I wanted to put ".00" after the price and the script seems to
trunciate to a real number.

any takers?

TIA and regards

Bob Callaghan




************************************************************************
***        The nice thing about going to a Drive In, If you          ***
***      didn't like the movie you can always slash the seats!       ***
************************************************************************