[ic] How to use value from text input box in perl block

IC ic at tvcables.co.uk
Wed May 27 09:18:22 UTC 2009


> >>> Hi folks,
> >>>
> >>> I am stuck on how to take the value from a text input box and use it
> as
> >> a
> >>> variable in a perl block, I want to enter an order number into a box
> and
> >> use
> >>> it as part of a perl sql query, I know this is simple for the gurus
> but
> >> I am
> >>> stuck....
> >> [perl transactions orderline]
> >> my ($tdb, $odb) = @Db{qw{transactions orderline}};
> >> my $order_number = $tdb->quote($CGI->{order_number});
> >>
> >> my $sql = "SELECT * from transactions where order_number =
> $order_number";
> >>
> >> my $results = $tdb->query($sql);
> >>
> >> # do something with $results
> >>
> >> return;
> >> [/perl]
> >
> > Hi Peter,
> >
> > I presume the input box needs a value="[cgi order_number]" to make this
> > work, this is what I tried but I get this message:-
> 
> No, the input box would need a name="order_number".
> 
> > Safe: 'require' trapped by operation mask at
> > /usr/local/interchange/lib/Vend/Table/DBI.pm line 1987.
> 
> This is not coming from the above code.  Or if it is Interchange has a
> pretty serious bug that we need to know about.
> 
> 
> Peter

Hi Peter,

I pasted your code exactly although I was previously testing it with a
different query, I loaded the page with ?order_number=95000 but it doesn't
work, the error log shows:-

Safe: 'require' trapped by operation mask at
/usr/local/interchange/lib/Vend/Table/DBI.pm line 1987.
>
>
> my ($tdb, $odb) = @Db{qw{transactions orderline}}; my $order_number =
$tdb->quote($CGI->{order_number});
>
> my $sql = "SELECT * from transactions where order_number = $order_number";
>
> my $results = $tdb->query($sql);
>
> # do something with $results
>
> return;
>
>

Andy.




More information about the interchange-users mailing list