Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
i have an html form, that has a pull down menu, that looks something like this:
<form action="something.php" method="post">
<select name="var1">
<option value="choice1">Choice1
<option value="choice2">Choice2
<option value="choice3">Choice3
</select>
<input type="submit" value="Submit">
</form>what i want to do, is make it so that when you select an item from the menu (Choice1, Choice2, Choice3), it sets var1 and also another variable. in other words, is it possible to have two variables be dependent on what is selected, instead of just one? i don't know if i can use arrays, since i am not the author and do not have access to the reciving script (its a paypal thing), because normaly the variable is constant, and not dependent on the selected item in the menu.
any help on the matter would be great.

ehhh...i decided to do the cop out. i put in a middle-man script. so now it sends to my script, which processes all the variables, and then modifies some of them, and redirects the user to the paypal script. its nice that paypal will accept the "get" method as well as "post", otherwise this wouldn't have worked. still open for suggestions, if anyone has any. if you want to check out the whole site, its lobstertees.com (friend's t-shirt web site that im doing the php for).

It will take javascript to do that. Probably you'd add an onClick() to the Select menu and have it call a function. Inside that function you'll set the second variable.
I'll be doing that tonight for paypal for my website (www.huskerswhobelieve.com). Is this related to setting the shipping costs. I'm going to have to do something like that to handle some of our shipping situations.
Be sure to come back and let us know if our suggestions helped!

Don! man it's been a while since i've been to this site...but i do remember you on here. couldn't seem to remember my password though. heh, oh well.
anyways, the problem i had is related to costs...the person had 4 different styles, with different prices. the problem is that the form only lets you define the price once (or concievably have the client choose the price from an option menu...but thats not exactly a good idea), while the style depends on an option menu. the solution script checked to see what style the person had selected, and then changed the price accordingly, and redirected the user to the paypal link with the modified variables using a meta tag.

So, for one 'add to cart' button, you'll have to check the style SELECTed and set the price accordingly?
That is similar to my problem. The most efficient way would be as I described. The SELECT should have a onClick() that calls a function to set the price HIDDEN variable or something like that.
I haven't actually done it yet but will be working on it tonight. If you don't get it to work, email me in a couple of days to see what I did.
Be sure to come back and let us know if our suggestions helped!

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |