Click here to get back home

sending hidden values AND option values at the same time ?

 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
sending hidden values AND option values at the same time ? Frederick Smith 09-12-2006
Get Chitika Premium
Posted by Frederick Smith on September 12, 2006, 12:52 am
Please log in for more thread options


Hi there,

I have been asked to help with some html to get a transaction started on a
PayPal shopping cart.

There's a dropdown with option values for the sizes, and another for the
colours of the products. I can get the "add to shopping cart" button to
work, and send the values to the PayPal site, and then either process the
transaction or continue shopping.... but.....

The problem is that a couple of the products comes in 3 sizes, small, medium
and large - and they are sold for 3 different prices, but the price for
each item is sent as a single fixed "hidden variable" in the same form.

Is there some way that I can get the drop down to send different hidden
values for the amount of the transaction AND the size.

something like ....

<option value="Small">Small</option> ( some operator here ) <input
type="hidden" name="amount" value="5">
<option value="Medium">Medium</option> ( some operator here ) <input
type="hidden" name="amount" value="10">
<option value="Large">Large</option> ( some operator here ) <input
type="hidden" name="amount" value="20">


might do the trick ... but I dont even know of its possible to join the
parameters together, let alone what sort of operator or syntax to use.
If its just impossible, I will resort to perl scripting - but it would be
nice to know that it could be done simply in html


Any suggestions



Frederick



Posted by Jukka K. Korpela on September 12, 2006, 2:59 am
Please log in for more thread options



> Is there some way that I can get the drop down to send different
> hidden values for the amount of the transaction AND the size.

No. Not in HTML, and you don't want to get different data depending on
whether client-side scripting is enabled or not, do you?

> but I dont even know of its possible to join
> the parameters together, let alone what sort of operator or syntax to
> use.

You seem to think that HTML might be some kind of a programming language.
Well, it isn't.

> If its just impossible, I will resort to perl scripting

"Resort to"? _Any_ reliable processing of form data _requires_ some
server-side code (though not necessarily in Perl, of course), so it's the
Real Thing to be done. You simply get the user input as defined by the form
markup and actual user actions, and then you can process it any way you need
to.

It would be grossly unsafe to include product prices into the HTML markup
and rely on their correctness. Even a child could create a copy of your
form, edit it, and submit an order with the price set to 0.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/


Posted by Jonathan N. Little on September 12, 2006, 10:32 am
Please log in for more thread options


Jukka K. Korpela wrote:
>
>> Is there some way that I can get the drop down to send different
>> hidden values for the amount of the transaction AND the size.
>
> No. Not in HTML, and you don't want to get different data depending on
> whether client-side scripting is enabled or not, do you?
>
>> but I dont even know of its possible to join
>> the parameters together, let alone what sort of operator or syntax to
>> use.
>
> You seem to think that HTML might be some kind of a programming
> language. Well, it isn't.
>
>> If its just impossible, I will resort to perl scripting
>
> "Resort to"? _Any_ reliable processing of form data _requires_ some
> server-side code (though not necessarily in Perl, of course), so it's
> the Real Thing to be done. You simply get the user input as defined by
> the form markup and actual user actions, and then you can process it any
> way you need to.
>
> It would be grossly unsafe to include product prices into the HTML
> markup and rely on their correctness. Even a child could create a copy
> of your form, edit it, and submit an order with the price set to 0.
>

So to simplify a little of what Jukka wrote, you need to build an order
form that collects your product's part/stock numbers, quantities,
customer info then set that to *your* server-side script
(Perl|Php|Python|ASP|Whatever) that will

1) Verify the user input as valid
2) Look up prices and stuff (out of reach of customers)
3) Build and format data for PayPal
4) Transmit to PayPal

Your HTML form should not go directly to PayPal.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

Similar ThreadsPosted
how pass option values to JS routine? November 18, 2007, 10:16 am
Smallest Possible width values April 1, 2005, 6:02 am
Class attribute values November 7, 2005, 7:27 am
splitting long attribute values February 16, 2007, 10:05 pm
Form Reload with Tainted Values April 28, 2008, 5:13 pm
forms that look like grids -- are values correlated? June 5, 2008, 2:13 pm
receipt of form values by an HTML page October 10, 2007, 2:56 pm
User hits back button - has to enter form values from scratch January 31, 2008, 8:39 pm
Time zone and 24 hours time format October 16, 2007, 4:25 pm
sending pages as emails February 10, 2008, 10:04 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap