>
> Hi
>
> I am very very new to perl. And after lots of work I did script a perl
> file to handle a online form (products order form). However, I am
> stuck at a point. I tried my best but could not get thru.
>
> The form is located at: http://www.kevincoffey.com/order.htm
>
> When I select a different shipping adrress, it DOESNOT work!
>
> I gave a RADIO button for :
>
> Shipping_Address: TRUE=SAME AS ABOVE (i.e. send to adove address)
> Shipping ADdress: FALSE = send to Floowing address
>
> And in the followings cript I gave it with a -- if .. else --
> statement.. but no use..
>
> Can someone pls help me?
>
> Regards
>
> Babul
>
In the future only post the relevant portions of your script until
someone asks for more. I almost skipped your post because it was so long.
> And the first perl file is:
> ===form1.pl===
>
> #!/usr/bin/perl
>
> use CGI;
> use CGI::Carp qw(fatalsToBrowser);
> use strict;
>
Good start, you should include 'use warnings'...
> my ($query, @params, $param, $paramVal);
> my ($csTravel);
> my (@allProductQuantities);
> my (@productIDs, $ID);
> my (@contactNameFields, @contactAddressFields, @contactOtherFields,
> $field, $value);
> my (@shippingNameFields, @shippingAddressFields, @shippingOtherFields);
> my ($productQuantity, $dollarValue);
>
You should declare your variables when you first use them rather than at
the top, it will help you avoid headaches and allow strictures and
scoping to be most affective.
>
> $csTravel = "[EMAIL PROTECTED],[EMAIL PROTECTED]";
> open (MAIL, "|/bin/mail -s 'CTS Order' $csTravel");
You should always check that 'open' succeeded and you should use a
module that handles sending of email from CPAN rather than doing your
mail handling manually like this. Trust me.
<snip>
> if ($query -> param ("Shipping_Preference") == "TRUE"){
You are using the '==' operator which is specifically for number
operations, you should use the 'eq' operator for string comparisons.
if ($query->param("Shipping_Preference") eq 'TRUE') {
Should fix the problem.
<snip>
>
> =====end of form1.pl===
>
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>