Click here to get back home

Hidden name= fields question

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Hidden name= fields question Angus Comber 06-18-2005
Get Chitika Premium
Posted by Angus Comber on June 18, 2005, 12:59 pm
Please log in for more thread options


Hello

I am working with an external perl script. I can submit something like
this:

<form target="mycart" action="https://www.website.com/cgi-bin/"
method="post">
<input type="image" src="https://www.website.com/btn/click-but.gif"
border="0"

name="submit" alt="Make payments with website!">
<input type="hidden" name="add" value="1">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="item_name" value="Widget 1 User (GB)">
<input type="hidden" name="item_number" value="Widget1UK">
<input type="hidden" name="amount" value="30.00">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="lc" value="GB">

Then I stick a button on my web page and that is fine.

But I would rather make this dynamic. Eg I would have a dropdown box where
user could select eg 1, 2, 3 etc User and amount would then be different
value. Then when I post to the cart I can send the relevant amount,
item_name, etc.

I can create the dropdown no problem but how do I make sure the dynamically
selected values are sent to mycart? eg rather than using:

<input type="hidden" name="amount" value="30.00"> - which is static, I will
have a variable called amount, where I dynamically set the vlaue.

Angus Comber



Posted by Jukka K. Korpela on June 18, 2005, 12:42 pm
Please log in for more thread options



> <form target="mycart"

Target Attribute Considered Harmful. It either opens a new window, or
you are playing with frames. Both are _bad_. Don't do target, mm'kay?

> <input type="image" src="https://www.website.com/btn/click-but.gif"

Image Submit Buttons Considered Harmful. They win nothing but esthetics
in the deeziner's eye, and they imply accessibility problems.

> <input type="hidden" name="amount" value="30.00">

Fine. Now I create a copy of your form, edit that element to contain,
say, value="0.00", and order some stuff for free. If your script
detects that, good for you. But then you didn't need that hidden field
in the first place, did you?

> But I would rather make this dynamic. Eg I would have a dropdown
> box where user could select eg 1, 2, 3 etc User and amount would
> then be different value.

And what would be the problem with that, apart from the obvious?
(The obvious part is that it is easier to users to type a number than
to select an item from a dropdown list.)

> I can create the dropdown no problem but how do I make sure the
> dynamically selected values are sent to mycart?

You can't, of course. HTML is no programming language. It's a poor
lonesome data format.

As usual, there will probably be someone who tells you to use
JavaScript. I wish I were a more dishonest person and took advantage of
such situations, ordering 1,000,000 widgets for the price of one simply
by disabling scripting on my browser.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


Posted by kchayka on June 18, 2005, 8:42 am
Please log in for more thread options


Jukka K. Korpela wrote:
>
>> <input ... alt="Make payments with website!">

It's PayPal, obviously. ;)

>> <input type="hidden" name="amount" value="30.00">
>
> Fine. Now I create a copy of your form, edit that element to contain,
> say, value="0.00", and order some stuff for free. If your script
> detects that, good for you. But then you didn't need that hidden field
> in the first place, did you?

I take it you're not familiar with the PayPal shopping cart.

This is a downside of using the PayPal cart. PayPal doesn't have any
"product" info except what is sent to it via form fields. PayPal does
have an encrypted form data option, but it doesn't work dynamically.
Thus if PayPal is generating the customer receipts, there aren't many
choices.

On the upside is that the PayPal cart isn't likely to be used for any
kind of high volume business, so it's unlikely a cheater trying to get
something for free would go unnoticed. The seller could just cancel the
transaction. It isn't ideal, but is usable (for the seller).

Now you know. :)

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.

Posted by Angus Comber on June 18, 2005, 1:57 pm
Please log in for more thread options


Are you saying I need to do this in something like perl?

Angus

>
>> <form target="mycart"
>
> Target Attribute Considered Harmful. It either opens a new window, or
> you are playing with frames. Both are _bad_. Don't do target, mm'kay?
>
>> <input type="image" src="https://www.website.com/btn/click-but.gif"
>
> Image Submit Buttons Considered Harmful. They win nothing but esthetics
> in the deeziner's eye, and they imply accessibility problems.
>
>> <input type="hidden" name="amount" value="30.00">
>
> Fine. Now I create a copy of your form, edit that element to contain,
> say, value="0.00", and order some stuff for free. If your script
> detects that, good for you. But then you didn't need that hidden field
> in the first place, did you?
>
>> But I would rather make this dynamic. Eg I would have a dropdown
>> box where user could select eg 1, 2, 3 etc User and amount would
>> then be different value.
>
> And what would be the problem with that, apart from the obvious?
> (The obvious part is that it is easier to users to type a number than
> to select an item from a dropdown list.)
>
>> I can create the dropdown no problem but how do I make sure the
>> dynamically selected values are sent to mycart?
>
> You can't, of course. HTML is no programming language. It's a poor
> lonesome data format.
>
> As usual, there will probably be someone who tells you to use
> JavaScript. I wish I were a more dishonest person and took advantage of
> such situations, ordering 1,000,000 widgets for the price of one simply
> by disabling scripting on my browser.
>
> --
> Yucca, http://www.cs.tut.fi/~jkorpela/
> Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
>



Posted by Jukka K. Korpela on June 19, 2005, 6:13 am
Please log in for more thread options



> Are you saying I need to do this in something like perl?

Comprehensive quoting is a sure sign of lack of comprehensive reading.
Please read what I wrote, instead of quoting everything. If problems
remain, indicate which part you didn't understand, and ask a specific
well-formulated question.

But yes, that's more or less what I'm saying: you need to understand
how forms work. See http://www.cs.tut.fi/~jkorpela/forms/ for clues.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


Similar ThreadsPosted
Moving to 4.01 strict: problem with hidden fields et al. January 16, 2005, 9:00 pm
Showing hidden answer when question clicked? June 13, 2005, 1:42 pm
What happens if several text fields have the same name? May 24, 2005, 10:00 am
non-remembering fields November 8, 2007, 1:29 pm
form fields and no-cache July 22, 2004, 11:10 pm
text fields in a form February 11, 2007, 2:33 pm
Hidden Directory September 1, 2004, 1:21 pm
Hidden text October 19, 2004, 5:12 pm
Hidden text. April 14, 2005, 2:54 pm
HTML Form "Lookup" Fields May 8, 2005, 4:23 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap