You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Richard Schilling <rs...@nationalinformatics.net> on 2003/05/27 10:26:11 UTC

strange Embperl behavior with INPUT tags when using DBI

Didn't see this one in the archives, so I thought I would mention it . 
. .


I'm using INPUT tags, in a way the documentation suggests Embperl will 
automatically insert values into the VALUE element:

	<FORM ACTION="details.epl" METHOD="POST">
		[# Embperl should insert the VALUE element in the field 
#]
		<INPUT TYPE="HIDDEN" NAME="Price">
		<INPUT TYPE="SUBMIT" VALUE="details">
	</FORM>

$fdat{'Price'} is defined for this form (e.g. defined($fdat{'Price'}) 
is true).

At the top of the page details.epl I have the following code 
($fdat{'Price'}=0 for this form):

	[-	$dbh = DBI->connect(" blah blah blah");
		$query = $dbh->prepare("SELECT COUNT(*) FROM pricetable 
where price >= $fdat{'Price'};");
		$query->execute or die "Couldn't run query.";
	-]


The execute statement dies because the SQL server reports a syntax 
error with the query.  Here's the output from the SQL log (the actual 
statement submitted to the server by Embperl):

	SELECT COUNT(*) FROM pricetable where price >= 0    0;

So, looks like Embperl inserts an extra value into $fdat somewhere?

Not sure what's happening here.  But when I specify the INPUT fields 
like this:

	<INPUT TYPE="HIDDEN" NAME="Price" VALUE="[+ $fdat{'Price'} +]">

I don't get the error.

Any clues?

--Richard Schilling

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: strange Embperl behavior with INPUT tags when using DBI

Posted by Richard Schilling <rs...@nationalinformatics.net>.
I double checked the code cause you got me thinking.  I was setting 
that field twice, because I didn't properly terminate another form 
defined on the page.

Thanks!

--Richard




On 2003.05.27 06:13 Tom Briles wrote:
> It looks like you are setting $fdat{'Price'} twice.  When you do that,
> the values are separated by a tab.
> 
> Are you using the [$ hidden $] tag in the form, but not at the end of
> the form?  That's a common cause for this behavior.
> 
> > -----Original Message-----
> > From: Richard Schilling [mailto:rschilling@nationalinformatics.net]
> > Sent: Tuesday, May 27, 2003 3:26 AM
> > To: embperl@perl.apache.org
> > Subject: strange Embperl behavior with INPUT tags when using DBI
> >
> >
> > Didn't see this one in the archives, so I thought I would
> > mention it .
> > . .
> >
> >
> > I'm using INPUT tags, in a way the documentation suggests
> > Embperl will
> > automatically insert values into the VALUE element:
> >
> > 	<FORM ACTION="details.epl" METHOD="POST">
> > 		[# Embperl should insert the VALUE element in the
> field
> > #]
> > 		<INPUT TYPE="HIDDEN" NAME="Price">
> > 		<INPUT TYPE="SUBMIT" VALUE="details">
> > 	</FORM>
> >
> > $fdat{'Price'} is defined for this form (e.g.
> defined($fdat{'Price'})
> > is true).
> >
> > At the top of the page details.epl I have the following code
> > ($fdat{'Price'}=0 for this form):
> >
> > 	[-	$dbh = DBI->connect(" blah blah blah");
> > 		$query = $dbh->prepare("SELECT COUNT(*) FROM
> pricetable
> > where price >= $fdat{'Price'};");
> > 		$query->execute or die "Couldn't run query.";
> > 	-]
> >
> >
> > The execute statement dies because the SQL server reports a syntax
> > error with the query.  Here's the output from the SQL log (the
> actual
> > statement submitted to the server by Embperl):
> >
> > 	SELECT COUNT(*) FROM pricetable where price >= 0    0;
> >
> > So, looks like Embperl inserts an extra value into $fdat somewhere?
> >
> > Not sure what's happening here.  But when I specify the INPUT fields
> > like this:
> >
> > 	<INPUT TYPE="HIDDEN" NAME="Price" VALUE="[+ $fdat{'Price'}
> +]">
> >
> > I don't get the error.
> >
> > Any clues?
> >
> > --Richard Schilling
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> > For additional commands, e-mail: embperl-help@perl.apache.org
> >
> >
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: strange Embperl behavior with INPUT tags when using DBI

Posted by Tom Briles <tb...@loopone.com>.
It looks like you are setting $fdat{'Price'} twice.  When you do that,
the values are separated by a tab.

Are you using the [$ hidden $] tag in the form, but not at the end of
the form?  That's a common cause for this behavior.

> -----Original Message-----
> From: Richard Schilling [mailto:rschilling@nationalinformatics.net]
> Sent: Tuesday, May 27, 2003 3:26 AM
> To: embperl@perl.apache.org
> Subject: strange Embperl behavior with INPUT tags when using DBI
>
>
> Didn't see this one in the archives, so I thought I would
> mention it .
> . .
>
>
> I'm using INPUT tags, in a way the documentation suggests
> Embperl will
> automatically insert values into the VALUE element:
>
> 	<FORM ACTION="details.epl" METHOD="POST">
> 		[# Embperl should insert the VALUE element in the field
> #]
> 		<INPUT TYPE="HIDDEN" NAME="Price">
> 		<INPUT TYPE="SUBMIT" VALUE="details">
> 	</FORM>
>
> $fdat{'Price'} is defined for this form (e.g. defined($fdat{'Price'})
> is true).
>
> At the top of the page details.epl I have the following code
> ($fdat{'Price'}=0 for this form):
>
> 	[-	$dbh = DBI->connect(" blah blah blah");
> 		$query = $dbh->prepare("SELECT COUNT(*) FROM pricetable
> where price >= $fdat{'Price'};");
> 		$query->execute or die "Couldn't run query.";
> 	-]
>
>
> The execute statement dies because the SQL server reports a syntax
> error with the query.  Here's the output from the SQL log (the actual
> statement submitted to the server by Embperl):
>
> 	SELECT COUNT(*) FROM pricetable where price >= 0    0;
>
> So, looks like Embperl inserts an extra value into $fdat somewhere?
>
> Not sure what's happening here.  But when I specify the INPUT fields
> like this:
>
> 	<INPUT TYPE="HIDDEN" NAME="Price" VALUE="[+ $fdat{'Price'} +]">
>
> I don't get the error.
>
> Any clues?
>
> --Richard Schilling
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org