On Sat, 2004-06-12 at 08:30 -0700, David Storrs wrote:
> On Fri, Jun 11, 2004 at 01:07:54PM +0100, mike wrote:
> > Has anyone ever come accross this wied problem before
> > 
> > I have a script which pulls records from a DB then loops into a form and
> > shows each record, with the id no being concatenated to the field name
> > to give a unique record id.
> > 
> > However if I have this
> > "Banked",textfield(-name=>'bk_amt'.$bank_inv,-value=>$bk_amt1);
> > 
> > the params are zeroed
> > 
> > but if I have this
> > 
> > "Banked",textfield(-name=>' bk_amt'.$bank_inv,-value=>$bk_amt1);
> >  
> > (ie; a space)
> > everything is fine
> > 
> > Anyone have any idea what is going on here?
> 
> 
> Can't really tell without seeing your form but my first guess would be
> that the HTML for the textfield looks something like this:
> 
>     <input type="text" name=" bk_amt" ...>
> 
> Meaning that its name actually IS ' bk_amt' and not 'bk_amt'.
> Therefore, when you try to access the field name without a space,
> there is no such field, so you get nothing.
> 

No, wrong way round, if I name the test field WITHOUT a space then I
have a problem, if there is a space it works sort of (it re-orders the
params)

this is the script in full (except user/pass info)
#!/usr/bin/perl -w
use warnings;
use CGI::Carp;
use CGI qw/:standard/;
print header;
print start_html(-title=>"Banking Input",-BGCOLOR=>'#FCD08C',);
use DBI;
;use DBD::Pg;
$dbh=DBI->connect("dbi:Pg:dbname=data_cc",$user,$pw);
$row1=$dbh->prepare("SELECT  date_paid,bank_inv,amount_paid, cheque ,
bk_date , bk_amt FROM vw_banking GROUP BY bank_inv,date_paid,
amount_paid,cheque,bk_date , bk_amt");
$row1->execute();
print start_multipart_form (POST,'bankchg.pl');
while (($date_paid,$bank_inv,$amount_paid,$cheque,$bk_date,$bk_amt1)=
$row1->fetchrow_array()){

print "$date_paid,$bank_inv,$amount_paid, $cheque , $bk_date ,
$bk_amt,", "<br />";

print " Inv Id ",textfield('id'.$bank_inv,$bank_inv,"10")," amount ",
textfield('amount'.$bank_inv,$amount_paid,"10"),"Bank date", textfield
('bk_date'.$bank_inv,$bk_date,"10"),"Cheque ",textfield
('cheque'.$bank_inv,$cheque,"20"), 
print "Banked",textfield(-name=>'bk amt'.$bank_inv,-value=>$bk_amt1);
}
print submit();
print end_form;
print end_html;

this is the table structure

            View "public.vw_banking"
   Column    |         Type          | Modifiers
-------------+-----------------------+-----------
 date_paid   | date                  |
 bank_inv    | integer               |
 amount_paid | numeric(10,2)         |
 code        | character varying(15) |
 sum         | numeric               |
 cheque      | character varying(20) |
 bk_date     | date                  |
 bk_amt      | numeric(15,2)         |


> --Dks
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to