Gossamer Forum
Home : General : Perl Programming :

Form Input

Quote Reply
Form Input
You know, I really hate when perl does things and you don't know why....

I'm submitting a form and doing an SQL query in the script using form input.

I have:

SELECT From Table WHERE Column = '$in{Field}'

I wasn't getting any results so printed out the query and it showed:

SELECT From Table WHERE Column = ''

...so obviously the input isn't coming along to my routine so I tried printing everything in %in....

Code:
die ( map { "\$in{$_} => $in{$_}\n" } keys %in );

....low and behold I see the $in{Field} input.

Both the die() and SQL query were printed in the same subroutine on the same line with no other code around.

How the heck can it print a value using die but not printing $in{Field} directly?

ARGHH!!!
Quote Reply
Re: [Paul] Form Input In reply to
Try:

Code:
SELECT From Table WHERE Column = "$in{Field}"

Interpolation, maybe?

- wil

Last edited by:

Wil: May 7, 2002, 11:53 AM
Quote Reply
Re: [Paul] Form Input In reply to
Are you using strict? Are you dying in the same scope as the SQL statement? Could be %in is not defined where you are using it.

Hard to tell without seeing the code.. =)

Cheers,

Alex
--
Gossamer Threads Inc.
Post deleted by Paul In reply to

Last edited by:

Paul: May 7, 2002, 1:25 PM
Post deleted by Paul In reply to

Last edited by:

Paul: May 7, 2002, 1:25 PM
Quote Reply
Re: [Alex] Form Input In reply to
Aww I don't like leaving traces of my deletions :(

Thanks for the replies I found the problem and yes it was the most obvious of mistakes but no it wasn't interpolation....grrrr....
Quote Reply
Re: [Paul] Form Input In reply to
What was the problem?

From the code you posted, interpolation did seem the problem, and in my experience; was the problem.

- wil
Quote Reply
Re: [Wil] Form Input In reply to
>>
From the code you posted, interpolation did seem the problem, and in my experience; was the problem.
<<

Perhaps if you could paste the code exactly as was into perl scripts then interpolation would be an issue but when you have:

$dbh->prepare("SELECT From Table WHERE Column = '$in{Field}'");

....then the single quotes won't cause a problem...infact if you leave them out DBI/SQL will barf.

Last edited by:

Paul: May 8, 2002, 2:54 AM