Re: CGI.pm strange results

2003-03-04 Thread zentara
On Mon, 3 Mar 2003 16:07:26 -0500, [EMAIL PROTECTED] (Todd Wade) wrote:


Zentara [EMAIL PROTECTED] wrote in message

 You might want to try assigning a variable name to param(quantity)
 first, before you set up the table. I don't know why, but sometimes
 the scripts don't like it any other way. I've run into this type of
 thing before, and just take the easy way out, and assign a variable.

This is not true at all.

Well what ever the reason is, it has worked that way sometimes for me.
When you start deeply nesting and quoting in tables and here documents,
Perl will sometimes fail to interpolate unless you force the value into
a variable.  I guess I havn't learned the trick yet.

If you look at the html source, there are multiple input fields are named
quanity. You need a way of indexing your quanity fields so you know which
value of the array to fetch while looping through the selected items.

Yeah, I realized that while thinking about it later. Another solution is
to put an separate order button along each item, or he can rename
the quantity parameter to quantity-furry, quantity-stripped, etc,etc.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CGI.pm strange results

2003-03-04 Thread Todd W

Zentara [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Mon, 3 Mar 2003 16:07:26 -0500, [EMAIL PROTECTED] (Todd Wade) wrote:

 
 Zentara [EMAIL PROTECTED] wrote in message
 
  You might want to try assigning a variable name to param(quantity)
  first, before you set up the table. I don't know why, but sometimes
  the scripts don't like it any other way. I've run into this type of
  thing before, and just take the easy way out, and assign a variable.
 
 This is not true at all.

 Well what ever the reason is, it has worked that way sometimes for me.
 When you start deeply nesting and quoting in tables and here documents,
 Perl will sometimes fail to interpolate unless you force the value into
 a variable.  I guess I havn't learned the trick yet.

Sorry, not true at all. There really is no trick. Interpolating is
interpolating is interpolating.

When you start ?deeply nesting? and quoting in tables and here documents,
perl will never fail to interpolate unless you don't understand the syntax
and semantics of injecting values into literals.

Perhaps you could post an example, because I am very curious. But taking an
educated guess at the problem you are having, I would say you are talking
about getting CGI.pm's param() function to return in a string.

my( $string ) = you ordered $q-param('quantity') foobars\n;

The quoting mechanism knows nothing about evaluating expressions. That's
what concatenation is for:

my( $string ) = you ordered  . $q-param('quantity') .  foobars\n;

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CGI.pm strange results

2003-03-04 Thread fliptop
On Tue, 4 Mar 2003 at 08:12, Todd W opined:

TW:my( $string ) = you ordered $q-param('quantity') foobars\n;
TW:
TW:The quoting mechanism knows nothing about evaluating expressions. That's
TW:what concatenation is for:
TW:
TW:my( $string ) = you ordered  . $q-param('quantity') .  foobars\n;

or sprintf:

my $string = sprintf you ordered %d foobars, $q-param('quantity');


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CGI.pm strange results

2003-03-03 Thread zentara
On Sun,  2 Mar 2003 10:50:39 -0600, [EMAIL PROTECTED] (David
Gilden) wrote:

Hello,

I am not understanding why I am getting strange data from the my CGI. 
Please point out what I have done wrong.
Thanks
Dave Gilden

See the result at, you have to 'order' on item to see the problem.
http://www.coraconnection.com/paul_s/pages/catalog.html

I looked at it and clicked on order, and it does what the code says.
With the exception of the quantity is zero.

I'm using the latest mozilla, it shows 1 row of a table, with a picture
of the item first, then it's description, the quantity (which isn't
right), then the escaped $Price

You might want to try assigning a variable name to param(quantity)
first, before you set up the table. I don't know why, but sometimes
the scripts don't like it any other way. I've run into this type of
thing before, and just take the easy way out, and assign a variable.

$quantity= param(quantity)
print  td, $quantity, /tdtd\$Price goes here/td\n;

Otherwise, give more explanation of what your problem is.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: CGI.pm strange results

2003-03-03 Thread Todd Wade

Zentara [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 On Sun,  2 Mar 2003 10:50:39 -0600, [EMAIL PROTECTED] (David
 Gilden) wrote:

 Hello,
 
 I am not understanding why I am getting strange data from the my CGI.
 Please point out what I have done wrong.
 Thanks
 Dave Gilden

 See the result at, you have to 'order' on item to see the problem.
 http://www.coraconnection.com/paul_s/pages/catalog.html

snip /

 You might want to try assigning a variable name to param(quantity)
 first, before you set up the table. I don't know why, but sometimes
 the scripts don't like it any other way. I've run into this type of
 thing before, and just take the easy way out, and assign a variable.

This is not true at all.

 $quantity= param(quantity)
 print  td, $quantity, /tdtd\$Price goes here/td\n;

 Otherwise, give more explanation of what your problem is.

If you look at the html source, there are multiple input fields are named
quanity. You need a way of indexing your quanity fields so you know which
value of the array to fetch while looping through the selected items.

Not really a perl problem, check out the CGI specifications and perldoc -m
CGI

Todd W.



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



CGI.pm strange results

2003-03-02 Thread David Gilden
Hello,

I am not understanding why I am getting strange data from the my CGI. 
Please point out what I have done wrong.
Thanks
Dave Gilden

In the HTML
form method=post action=/cgi-bin/build_order.cgi
img src=../images/GUC-247-small.jpg alt=GUC-247-small width=120 height=179 
some descriptive text goes here. 
div class=item
ORDER input type=checkbox name=hand-bag-style-dots value=GUC-247-small 
onclick=upDateQuantity()
br
QUANTITY input type=text size=2 name=quantity value=0 tabindex=26 
onchange=checkNumber(this.value,0)
/div


In the PERL
#!/usr/bin/perl -w
use CGI qw/:standard/;
#...  unrelated code removed  ...

print qq|table border=1\n|;

foreach $name (param()){
my $val= param($name);
my $nextRow = ($name =~ m/.jpg/);
print  tr if $nextRow; 
print qq|tdimg src=../paul_s/images/| . $val . qq|.jpg alt=$name width=120 
height=179 alt= bag /td\n|;
print  td$name: $val/td;
print  td, param(quantity), /tdtd\$Price goes here/td\n;
print /tr\n if $nextRow;
}
print /table\n;

See the result at, you have to 'order' on item to see the problem.
http://www.coraconnection.com/paul_s/pages/catalog.html
==
 Cora Connection: Your West African Music Source
  Resources, Recordings, Instruments  More!
   http://www.coraconnection.com/ 
==

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]