Hello Monks,

I have a script where when a user clicks on the Checkout button you should be redirected to a secure connection and brought to a billing form. What's happening I'm being brought back to my main product category page.

Can someone take a look at my code and help me figure out why my billing page is not appearing when I'm in the secure connection?

Shouldn't this line, which is in the get_checkout_link sub,
return (a ({-href => $url. "?choice=checkout"},
pass me to my display_billing_form which is in the dispatch section of my code? It's not.

sub get_checkout_link { my $label = shift; my $url; ($url = "https://www.addr.com/~summitwe/cgi-bin/pet_shop.cgi") =~ +s/^http:/https:/i; return (a ({-href => $url. "?choice=checkout"}, img ({-src => "../ +images/checkout.jpg", -border => "0", escapeHTML ($label)}))); }

Dispatch section of code when user clicks Checkout button.
elsif ($choice eq "checkout") # customer is ready to check out { $page .= display_billing_form ($dbh, $cart_ref); }


Here's is the code for the billing form.
sub display_billing_form { my ($dbh, $cart_ref) = @_; my ($state_val_ref, $state_label_ref); my $page; my $JSCRIPT; if (!keys (%{$cart_ref})) { $page .= p ({-style=>"font-family: verdana; font-size: 10pt;"} +, "Shopping cart is empty."); return ($page); } # Get references to lists of state abbreviations # and names for state popup menu ($state_val_ref, $state_label_ref) = WebDB::get_lookup_values ( $dbh, "SELECT abbrev, name FROM us_state ORDER BY na +me"); $page .= format_checkout_html ($cart_ref, 1); $page .= p({ -style => "font-family: verdana; font-size: 10pt;" +}, "Shipping and tax may be added to your order.\n" . "To estimate shipping and tax, please see the " . span({-style => "text-decoration: underline; colo +r: blue; cursor: pointer;", -onClick => "launchwin()"}, "Shipping and Tax") . " page.\n"); $page .= start_form (-method => "POST", -action => url ()); $page .= table ({-align => "center", -valign=>"center", -style=>" +font-family: verdana; font-size: 10pt;"}, Tr ({- +bgcolor=>"blue", -style=>"font-family: verdana; font-size: 10pt; colo +r: yellow; font-weight: 700;"}, + td ({-colspan => "2"},"Customer Information") ), Tr ( td ("Name:"), td (textfield (-name => "cust_name", -size => "40" +)) ), Tr ( td ("Address:"), td (textfield (-name => "street", -size => "60")) ), Tr ( td ("City:"), td (textfield (-name => "city", -size => "60")) ), Tr ( td ("State:"), td (popup_menu (-name => "state", -values => $state_val_ref, -labels => $state_label_ref)) ), Tr ( td ("Zip code:"), td (textfield (-name => "zip", -size => "10")) ), Tr ( td ("Email address:"), td (textfield (-name => "cust_email", -size => "60 +")) ), Tr ( td ("Daytime Phone:"), td (textfield (-name => "cust_dayph", -size => "20 +")) ), Tr ( td ("Evening Phone:"), td (textfield (-name => "cust_evenph", -size => "2 +0")) ), Tr ({-bgcolor=>"blue", -style=>"font-family: v +erdana; font-size: 10pt; color: yellow; font-weight: 700;"}, td ({-colspan => "2"},"Shipping Informat +ion") ), Tr ( td ("Name:"), td (textfield (-name => "ship_name", -size => "40" +)) ), Tr ( td ("Address:"), td (textfield (-name => "ship_street", -size => "6 +0")) ), Tr ( td ("City:"), td (textfield (-name => "ship_city", -size => "60" +)) ), Tr ( td ("State:"), td (popup_menu (-name => "ship_state", -values => $state_val_ref, -labels => $state_label_ref)) ), Tr ( td ("Zip code:"), td (textfield (-name => "ship_zip", -size => "10") +) ), Tr ( td ("Email address:"), td (textfield (-name => "ship_email", -size => "60 +")) ), Tr ( td ("Daytime Phone:"), td (textfield (-name => "ship_dayph", -size => "20 +")) ), Tr ( td ("Evening Phone:"), td (textfield (-name => "ship_evenph", -size => "2 +0")) ), Tr ({-bgcolor=>"blue", -style=>"font-family: v +erdana; font-size: 10pt; color: yellow; font-weight: 700;"}, td ({-colspan => "2"},"Shipping Method") ), Tr ( td ("Please select a shipping method:"), td (popup_menu (-name => "method", -valu +es => ["ND", "23D", "NDD"], -labels => {"ND" => "Normal Delivery", "2 +3D" => "2-3 Day Delivery", "NDD" => "Next Day Delivery"})) ) ) . br () . submit (-name => "choice", -value => "proceed to checkou +t") . end_form (); return ($page); }

Thank you for all your help.

In reply to Secure Connection Redirection problem by b310

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.