my $customer_id; $customer_id = param("customer_id"); print header(), start_html (-title => "Order Tracking System", -bgcolor => "white"); my $choice = lc (param ("choice")); if ($choice eq "submit") # customer submitted order number { get_customer (); print_results (); } else { print p (escapeHTML ("Logic error, unknown choice: $choice")); } print end_html(); sub get_customer { my ($dbh, $customer_id) = @_; $dbh = WebDB::connect (); my $sth = $dbh->prepare ("SELECT * FROM Shipments WHERE customer_id = ?"); $sth->execute($customer_id); while (my $track_ref = $sth->fetchrow_hashref ()){ push(@customer, $track_ref); } return(\@customer); } sub print_results { my $customer = get_customer($customer_id); print table ({-border => 0}, Tr ({-align => "CENTER", -valign=>"TOP", -BGCOLOR=>"silver", -style=>"font-family: verdana; font-size: 10pt;"}, th ({-width=>"50"},("Customer ID")), th ({-width=>"50"},("Carrier")), th ({-width=>"90"},("Tracking Number")) )); foreach my $row (@$customer) { print table ({-border => 0}, Tr ({-valign=>"center", -style=>"font-family: verdana; font-size: 10pt;"}, td ($row->{customer_id}), td ($row->{carrier_id}), td ($row->{tracking_number}) )); } print start_form (-action => "http://wwwapps.ups.com/tracking/tracking.cgi", -method => "POST"), table ( Tr ( td ("UPS Tracking Number:"), td (textfield (-name => "tracknum")) ), ), submit (-name => "choice", -value => "Track"), end_form (); }