On Fri, 30 May 2003 21:47:03 -0400, you wrote:

>Hi all, I've got a really tough question, I am building an application that 
>allows PayPal's shopping cart to have multiple items, but also multiple 
>prices for the same item, but a different style or size or color, and Im 
>quite stuck on how I would get the prices of the item according to it's color 
>or description from a dropdown and insert it into a hidden field to be 
>inserted into the shopping cart, as far as I know I can't modify the dropdown 
>or it will not show up in the options of the shopping cart, so I need to work 
>around the dropdowns.
>
>Basically what Im trying to do is when lets say "black" is selected from the 
>dropdown, then the price for a black shirt is grabbed from the database and 
>inserted into a hidden field.

Exactly what data are you trying to store? Something like this?

for each item_chosen
    (id, qty, colour, price)

One approach is to put all your data in an array, serialize the array and
store that as the hidden field.

Another is to use sessions, and store the array in the session (probably
faster).

A third is to write the data out to a series of hidden fields beginning with
xyz (xyz1, xyz2, xyz3, etc), and iterate over the contents of the returned
form to find the xyz* fields.

Of the three, sessions are the one you /should/ use - because if pricing
data goes out to the client, it can be altered.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to