+<%perl>
+
+$emsgokorprint->($emsg) or $commodid=undef;
+return unless defined $commodid;
+$someresults->();
+
+#---------- actually compute the results and print them ----------
+
+foreach my $bs (split /_/, $ARGS{BuySell}) {
+ $bs =~ m/^(buy|sell)$/ or die;
+ $bs= $1;
+
+ my $sth= $dbh->prepare(
+ "SELECT archipelago, islandname, stallname, price, qty
+ FROM $bs NATURAL JOIN stalls NATURAL JOIN islands
+ WHERE commodid = ?"
+ );
+ # fixme this query is utterly wrong